pub struct Cached<C: Ctx, E: UserEvent> {
pub cached: Option<Value>,
pub node: Node<C, E>,
}
Fields§
§cached: Option<Value>
§node: Node<C, E>
Implementations§
Source§impl<C: Ctx, E: UserEvent> Cached<C, E>
impl<C: Ctx, E: UserEvent> Cached<C, E>
pub fn new(node: Node<C, E>) -> Self
Sourcepub fn update(&mut self, ctx: &mut ExecCtx<C, E>, event: &mut Event<E>) -> bool
pub fn update(&mut self, ctx: &mut ExecCtx<C, E>, event: &mut Event<E>) -> bool
update the node, return whether the node updated. If it did, the updated value will be stored in the cached field, if not, the previous value will remain there.
Sourcepub fn update_changed(
&mut self,
ctx: &mut ExecCtx<C, E>,
event: &mut Event<E>,
) -> bool
pub fn update_changed( &mut self, ctx: &mut ExecCtx<C, E>, event: &mut Event<E>, ) -> bool
update the node, return true if the node updated AND the new value is different from the old value. The cached field will only be updated if the value changed.
Trait Implementations§
Auto Trait Implementations§
impl<C, E> Freeze for Cached<C, E>
impl<C, E> !RefUnwindSafe for Cached<C, E>
impl<C, E> Send for Cached<C, E>
impl<C, E> Sync for Cached<C, E>
impl<C, E> Unpin for Cached<C, E>
impl<C, E> !UnwindSafe for Cached<C, E>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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