Struct i_slint_core::properties::PropertyTracker
source · [−]pub struct PropertyTracker<ChangeHandler = ()> { /* private fields */ }
Expand description
This structure allow to run a closure that queries properties, and can report if any property we accessed have become dirty
Implementations
sourceimpl<ChangeHandler: PropertyChangeHandler> PropertyTracker<ChangeHandler>
impl<ChangeHandler: PropertyChangeHandler> PropertyTracker<ChangeHandler>
sourcepub fn is_dirty(&self) -> bool
pub fn is_dirty(&self) -> bool
Any of the properties accessed during the last evaluation of the closure called from the last call to evaluate is potentially dirty.
sourcepub fn evaluate<R>(self: Pin<&Self>, f: impl FnOnce() -> R) -> R
pub fn evaluate<R>(self: Pin<&Self>, f: impl FnOnce() -> R) -> R
Evaluate the function, and record dependencies of properties accessed within this function. If this is called during the evaluation of another property binding or property tracker, then any changes to accessed properties will also mark the other binding/tracker dirty.
sourcepub fn evaluate_as_dependency_root<R>(
self: Pin<&Self>,
f: impl FnOnce() -> R
) -> R
pub fn evaluate_as_dependency_root<R>(
self: Pin<&Self>,
f: impl FnOnce() -> R
) -> R
Evaluate the function, and record dependencies of properties accessed within this function. If this is called during the evaluation of another property binding or property tracker, then any changes to accessed properties will not propagate to the other tracker.
sourcepub fn evaluate_if_dirty<R>(self: Pin<&Self>, f: impl FnOnce() -> R) -> Option<R>
pub fn evaluate_if_dirty<R>(self: Pin<&Self>, f: impl FnOnce() -> R) -> Option<R>
Call Self::evaluate
if and only if it is dirty.
But register a dependency in any case.
sourcepub fn new_with_change_handler(handler: ChangeHandler) -> Self
pub fn new_with_change_handler(handler: ChangeHandler) -> Self
Sets the specified callback handler function, which will be called if any properties that this tracker depends on change their value.
Trait Implementations
sourceimpl Default for PropertyTracker<()>
impl Default for PropertyTracker<()>
Auto Trait Implementations
impl<ChangeHandler = ()> !RefUnwindSafe for PropertyTracker<ChangeHandler>
impl<ChangeHandler = ()> !Send for PropertyTracker<ChangeHandler>
impl<ChangeHandler = ()> !Sync for PropertyTracker<ChangeHandler>
impl<ChangeHandler = ()> !Unpin for PropertyTracker<ChangeHandler>
impl<ChangeHandler = ()> !UnwindSafe for PropertyTracker<ChangeHandler>
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