pub struct Delta {
pub changed: HashMap<String, ValueWord>,
pub removed: Vec<String>,
}Expand description
A delta between two values, keyed by content path.
Paths use dot-separated notation:
"field_name"for top-level fields of a TypedObject"field_name.nested"for nested fields"[0]","[1]"for array indices"frames.[0].locals.[2]"for deeply nested paths
Fields§
§changed: HashMap<String, ValueWord>Fields/paths that changed, mapped to their new values.
removed: Vec<String>Paths that were removed (present in old, absent in new).
Implementations§
Source§impl Delta
impl Delta
Sourcepub fn change_count(&self) -> usize
pub fn change_count(&self) -> usize
Number of changes (additions + modifications + removals).
Sourcepub fn patch(
&self,
base: &ValueWord,
schemas: &TypeSchemaRegistry,
) -> (ValueWord, Vec<String>)
pub fn patch( &self, base: &ValueWord, schemas: &TypeSchemaRegistry, ) -> (ValueWord, Vec<String>)
Apply this delta to a base value, producing the updated value.
This is a convenience wrapper around patch_value that validates
delta paths before applying. Invalid paths (empty segments, leading
or trailing dots) are silently skipped.
§Path validation
Each path in changed and removed is checked for basic structural
validity:
- Must not be empty (except the root sentinel
"."). - Must not contain empty segments (e.g.
"a..b"). - Must not start or end with
"."(except the root sentinel).
Paths that fail validation are excluded from the applied delta and
collected into the returned Vec of rejected path strings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Delta
impl RefUnwindSafe for Delta
impl Send for Delta
impl Sync for Delta
impl Unpin for Delta
impl UnsafeUnpin for Delta
impl UnwindSafe for Delta
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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