Enum serde_intermediate::versioning::Change
source · [−]pub enum Change {
Same,
Removed,
Changed(Intermediate),
Added(Intermediate),
PartialChange(Box<Change>),
PartialSeq(Vec<(usize, Change)>),
PartialMap(Vec<(Intermediate, Change)>),
PartialStruct(Vec<(String, Change)>),
}
Expand description
Information about change between two intermediate data.
Variants
Same
Values are same.
Removed
Value was removed.
Changed(Intermediate)
Tuple Fields
0: Intermediate
Value.
Value was entirely changed.
Added(Intermediate)
Tuple Fields
0: Intermediate
Value.
Value was added.
PartialChange(Box<Change>)
Value was partially changed.
PartialSeq(Vec<(usize, Change)>)
Sequence of values was partially changed.
PartialMap(Vec<(Intermediate, Change)>)
Tuple Fields
0: Vec<(Intermediate, Change)>
List of changes: (key, change)
.
Map of key-values was partially changed.
PartialStruct(Vec<(String, Change)>)
Structure with field-value was partially changed.
Implementations
sourceimpl Change
impl Change
pub fn same() -> Self
pub fn removed() -> Self
pub fn changed(value: impl Into<Intermediate>) -> Self
pub fn added(value: impl Into<Intermediate>) -> Self
pub fn partial_change(change: Self) -> Self
pub fn partial_seq() -> Self
pub fn partial_map() -> Self
pub fn partial_struct() -> Self
pub fn partial_seq_item(self, index: usize, change: Self) -> Self
pub fn partial_map_item(
self,
key: impl Into<Intermediate>,
change: Self
) -> Self
pub fn partial_struct_item(self, name: impl ToString, change: Self) -> Self
pub fn is_same(&self) -> bool
pub fn difference(
prev: &Intermediate,
next: &Intermediate,
options: &DiffOptions
) -> Self
pub fn sequence_difference(
prev: &[Intermediate],
next: &[Intermediate],
options: &DiffOptions
) -> Vec<(usize, Self)>
pub fn patch(&self, value: &Intermediate) -> Result<Option<Intermediate>>
pub fn data_difference<P, N>(
prev: &P,
next: &N,
options: &DiffOptions
) -> Result<Self> where
P: Serialize,
N: Serialize,
pub fn data_patch<T>(&self, data: &T) -> Result<Option<T>> where
T: Serialize + DeserializeOwned,
pub fn total_bytesize(&self) -> usize
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Change
impl<'de> Deserialize<'de> for Change
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialOrd<Change> for Change
impl PartialOrd<Change> for Change
sourcefn partial_cmp(&self, other: &Change) -> Option<Ordering>
fn partial_cmp(&self, other: &Change) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl StructuralPartialEq for Change
Auto Trait Implementations
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnwindSafe for Change
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more