pub trait Node:
Clone
+ Default
+ PartialEq {
type Update;
type Diff;
const IS_CONTAINER: bool;
// Required methods
fn apply_update(&mut self, update: Self::Update);
fn as_update(&self) -> Self::Update;
fn compute_diff(&self, other: &Self) -> Option<Self::Diff>;
fn apply_diff(&mut self, diff: Self::Diff);
fn as_diff(&self) -> Self::Diff;
fn merge(&self, merge: &mut Self);
fn is_empty(&self) -> bool;
}Expand description
A trait implemented by datastructures that can be mutated by applying a succession of updates.
Required Associated Constants§
const IS_CONTAINER: bool
Required Associated Types§
Required Methods§
Sourcefn apply_update(&mut self, update: Self::Update)
fn apply_update(&mut self, update: Self::Update)
Apply the given update to this struct
Sourcefn as_update(&self) -> Self::Update
fn as_update(&self) -> Self::Update
Get the update corresponding to this struct, that is the update to be applied to the default instance to obtain this struct.
Sourcefn compute_diff(&self, other: &Self) -> Option<Self::Diff>
fn compute_diff(&self, other: &Self) -> Option<Self::Diff>
Get the differences between self and other.
The returned diff type represents the changes to apply to
self to obtain other.
Sourcefn apply_diff(&mut self, diff: Self::Diff)
fn apply_diff(&mut self, diff: Self::Diff)
Apply the given diff to this struct
Sourcefn as_diff(&self) -> Self::Diff
fn as_diff(&self) -> Self::Diff
Return the diff object to apply to obtain this current updatable value.
Sourcefn merge(&self, merge: &mut Self)
fn merge(&self, merge: &mut Self)
Overwrite the merge struct with the values from self.
This can be used for templating.
fn is_empty(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<K, R> Node for RecordMap<K, R>
impl<K, R> Node for RecordMap<K, R>
const IS_CONTAINER: bool = true
type Update = RecordMapUpdates<K, R>
type Diff = RecordMapDiff<K, R>
Source§impl<K, V> Node for ValueMap<K, V>
impl<K, V> Node for ValueMap<K, V>
const IS_CONTAINER: bool = true
type Update = ValueMapUpdates<K, V>
type Diff = ValueMapDiff<K, V>
Source§impl<K> Node for ValueSet<K>
impl<K> Node for ValueSet<K>
const IS_CONTAINER: bool = true
type Update = ValueSetUpdates<K>
type Diff = ValueSetDiff<K>
Source§impl<R> Node for OptRecord<R>where
R: Node,
A config item for amending a mandatory value
impl<R> Node for OptRecord<R>where
R: Node,
A config item for amending a mandatory value
const IS_CONTAINER: bool = true
type Update = OptRecordUpdate<R>
type Diff = OptRecordDiff<R>
Source§impl<V> Node for OptValue<V>
A config item for amending a mandatory value
impl<V> Node for OptValue<V>
A config item for amending a mandatory value