pub struct TrackedField<'s, T, F> { /* private fields */ }Expand description
A tracked field in a tracked struct which sets a flag when the value is changed.
Implementations§
Source§impl<'s, T, F> TrackedField<'s, T, F>
impl<'s, T, F> TrackedField<'s, T, F>
Sourcepub fn new(flag: F, track_flags: &'s mut F, value: &'s mut T) -> Self
pub fn new(flag: F, track_flags: &'s mut F, value: &'s mut T) -> Self
Create a new tracked field
Sourcepub fn force_set(&mut self, value: T)
pub fn force_set(&mut self, value: T)
Forces an update, regardless of whether the value has changed.
Sourcepub fn update(&mut self, f: impl FnOnce(&mut T) -> bool) -> bool
pub fn update(&mut self, f: impl FnOnce(&mut T) -> bool) -> bool
Updates the value via a closure It should return true if the value has changed.
Sourcepub fn force_update(&mut self, f: impl FnOnce(&mut T))
pub fn force_update(&mut self, f: impl FnOnce(&mut T))
Forces an update via a closure
Trait Implementations§
Source§impl<T, F> AddAssign<T> for TrackedField<'_, T, F>
impl<T, F> AddAssign<T> for TrackedField<'_, T, F>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl<T, F> Deref for TrackedField<'_, T, F>
impl<T, F> Deref for TrackedField<'_, T, F>
Auto Trait Implementations§
impl<'s, T, F> Freeze for TrackedField<'s, T, F>where
F: Freeze,
impl<'s, T, F> RefUnwindSafe for TrackedField<'s, T, F>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<'s, T, F> Send for TrackedField<'s, T, F>
impl<'s, T, F> Sync for TrackedField<'s, T, F>
impl<'s, T, F> Unpin for TrackedField<'s, T, F>where
F: Unpin,
impl<'s, T, F> !UnwindSafe for TrackedField<'s, T, F>
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