pub struct FieldDiff {
changed: Vec<FieldChange>,
same: Vec<&'static str>,
}Expand description
Fields compared on one resource, split into those that differ and those that already match.
Fields§
§changed: Vec<FieldChange>§same: Vec<&'static str>Implementations§
Source§impl FieldDiff
impl FieldDiff
Sourcepub fn check<'a, O: Facet<'a>, N: Facet<'a>>(
&mut self,
name: &'static str,
equal: bool,
old: &O,
new: &N,
) -> bool
pub fn check<'a, O: Facet<'a>, N: Facet<'a>>( &mut self, name: &'static str, equal: bool, old: &O, new: &N, ) -> bool
Note one compared field and return whether it differs.
Sourcepub fn compare<'a, T: Facet<'a> + PartialEq>(
&mut self,
name: &'static str,
old: Option<&'a T>,
new: &T,
) -> bool
pub fn compare<'a, T: Facet<'a> + PartialEq>( &mut self, name: &'static str, old: Option<&'a T>, new: &T, ) -> bool
Compare one field with its live value, if the resource exists.
Sourcepub fn want<'a, T, D, L>(
&mut self,
name: &'static str,
desired: D,
live: L,
) -> Option<T>
pub fn want<'a, T, D, L>( &mut self, name: &'static str, desired: D, live: L, ) -> Option<T>
Compare a declared field with its live value.
Returns the value to write when the field is declared and differs. An undeclared field is not compared.
Sourcepub fn want_set(
&mut self,
name: &'static str,
desired: &NameSet,
live: Option<&NameSet>,
) -> Option<NameSet>
pub fn want_set( &mut self, name: &'static str, desired: &NameSet, live: Option<&NameSet>, ) -> Option<NameSet>
Compare a declared set with its live value. A missing live value is the empty set.
Returns the set to write when it differs.
Sourcepub const fn has_changes(&self) -> bool
pub const fn has_changes(&self) -> bool
Whether any compared field differs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FieldDiff
impl RefUnwindSafe for FieldDiff
impl Send for FieldDiff
impl Sync for FieldDiff
impl Unpin for FieldDiff
impl UnsafeUnpin for FieldDiff
impl UnwindSafe for FieldDiff
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