pub struct OwnedChange<'a> {
pub path: String,
pub before: Option<&'a Value>,
pub after: Option<&'a Value>,
}Expand description
One field path whose value differs between before and after a write, as this crate computes and holds it.
before/after are None exactly when the path was absent on that
side — absence is a value, not a missing OwnedChange. A path present
with an identical value on both sides is not represented at all: this is
a diff, and an unchanged path did not change.
path is an owned String here rather than a borrow into the record:
the paths themselves are computed while walking the structure
("foo.bar[2]" is built, not found), and something has to own the
result. Change is the borrowed view of this a gate actually receives
— see OwnedChange::as_change — so the ownership lives here, once,
rather than at every call site that needs one.
Fields§
§path: StringDot-and-bracket notation from the record’s root: "displayName",
"labels.values[0].val".
before: Option<&'a Value>What this path held before the write. None if it was absent.
after: Option<&'a Value>What this path holds after the write. None if it is now absent.
Implementations§
Trait Implementations§
Source§impl<'a> Clone for OwnedChange<'a>
impl<'a> Clone for OwnedChange<'a>
Source§fn clone(&self) -> OwnedChange<'a>
fn clone(&self) -> OwnedChange<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for OwnedChange<'a>
impl<'a> Debug for OwnedChange<'a>
Source§impl<'a> PartialEq for OwnedChange<'a>
impl<'a> PartialEq for OwnedChange<'a>
Source§fn eq(&self, other: &OwnedChange<'a>) -> bool
fn eq(&self, other: &OwnedChange<'a>) -> bool
self and other values to be equal, and is used by ==.impl<'a> StructuralPartialEq for OwnedChange<'a>
Auto Trait Implementations§
impl<'a> Freeze for OwnedChange<'a>
impl<'a> RefUnwindSafe for OwnedChange<'a>
impl<'a> Send for OwnedChange<'a>
impl<'a> Sync for OwnedChange<'a>
impl<'a> Unpin for OwnedChange<'a>
impl<'a> UnsafeUnpin for OwnedChange<'a>
impl<'a> UnwindSafe for OwnedChange<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more