pub struct GenericPatch<V>where
V: DiffableValue,{
pub operations: Vec<GenericPatchOperation<V>>,
}Expand description
A collection of patch operations (format-agnostic)
Represents a complete diff between two values as a sequence of operations.
Fields§
§operations: Vec<GenericPatchOperation<V>>The operations in this patch
Implementations§
Source§impl<V> GenericPatch<V>where
V: DiffableValue,
impl<V> GenericPatch<V>where
V: DiffableValue,
Sourcepub const fn new() -> GenericPatch<V>
pub const fn new() -> GenericPatch<V>
Create a new empty patch
Sourcepub const fn with_operations(
operations: Vec<GenericPatchOperation<V>>,
) -> GenericPatch<V>
pub const fn with_operations( operations: Vec<GenericPatchOperation<V>>, ) -> GenericPatch<V>
Create a patch with the given operations
Sourcepub fn push(&mut self, op: GenericPatchOperation<V>)
pub fn push(&mut self, op: GenericPatchOperation<V>)
Add an operation to this patch
Sourcepub fn iter(&self) -> impl Iterator<Item = &GenericPatchOperation<V>>
pub fn iter(&self) -> impl Iterator<Item = &GenericPatchOperation<V>>
Iterate over operations
Sourcepub fn operations_at_prefix(
&self,
prefix: &str,
) -> Vec<&GenericPatchOperation<V>>
pub fn operations_at_prefix( &self, prefix: &str, ) -> Vec<&GenericPatchOperation<V>>
Get operations that affect a specific path prefix
Trait Implementations§
Source§impl<V> Clone for GenericPatch<V>where
V: Clone + DiffableValue,
impl<V> Clone for GenericPatch<V>where
V: Clone + DiffableValue,
Source§fn clone(&self) -> GenericPatch<V>
fn clone(&self) -> GenericPatch<V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<V> Debug for GenericPatch<V>where
V: Debug + DiffableValue,
impl<V> Debug for GenericPatch<V>where
V: Debug + DiffableValue,
Source§impl<V> Default for GenericPatch<V>where
V: Default + DiffableValue,
impl<V> Default for GenericPatch<V>where
V: Default + DiffableValue,
Source§fn default() -> GenericPatch<V>
fn default() -> GenericPatch<V>
Returns the “default value” for a type. Read more
Source§impl<V> FromIterator<GenericPatchOperation<V>> for GenericPatch<V>where
V: DiffableValue,
impl<V> FromIterator<GenericPatchOperation<V>> for GenericPatch<V>where
V: DiffableValue,
Source§fn from_iter<I>(iter: I) -> GenericPatch<V>where
I: IntoIterator<Item = GenericPatchOperation<V>>,
fn from_iter<I>(iter: I) -> GenericPatch<V>where
I: IntoIterator<Item = GenericPatchOperation<V>>,
Creates a value from an iterator. Read more
Source§impl<V> IntoIterator for GenericPatch<V>where
V: DiffableValue,
impl<V> IntoIterator for GenericPatch<V>where
V: DiffableValue,
Source§type Item = GenericPatchOperation<V>
type Item = GenericPatchOperation<V>
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<GenericPatchOperation<V>>
type IntoIter = IntoIter<GenericPatchOperation<V>>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <GenericPatch<V> as IntoIterator>::IntoIter
fn into_iter(self) -> <GenericPatch<V> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Auto Trait Implementations§
impl<V> Freeze for GenericPatch<V>
impl<V> RefUnwindSafe for GenericPatch<V>where
V: RefUnwindSafe,
impl<V> Send for GenericPatch<V>where
V: Send,
impl<V> Sync for GenericPatch<V>where
V: Sync,
impl<V> Unpin for GenericPatch<V>where
V: Unpin,
impl<V> UnwindSafe for GenericPatch<V>where
V: UnwindSafe,
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