pub struct Memo<T> { /* private fields */ }
Expand description
Memo computes the value from the closure on creation, and stores the value.
It will act like a Signal when the value is different with the computed value from last run, i.e., it will trigger a effect run when you Get() it whenever the computed value changes to a different value.
Trait Implementations§
Source§impl<T: Clone> SignalGet<T> for Memo<T>
impl<T: Clone> SignalGet<T> for Memo<T>
Source§fn get_untracked(&self) -> Twhere
T: 'static,
fn get_untracked(&self) -> Twhere
T: 'static,
Clones and returns the current value stored in the Signal, but it doesn’t subscribe
to the current running effect.
Source§fn get(&self) -> Twhere
T: 'static,
fn get(&self) -> Twhere
T: 'static,
Clones and returns the current value stored in the Signal, and subscribes
to the current running effect to this Signal.
Source§fn try_get(&self) -> Option<T>where
T: 'static,
fn try_get(&self) -> Option<T>where
T: 'static,
Try to clone and return the current value stored in the Signal, and returns None
if it’s already disposed. It subscribes to the current running effect.
Source§fn try_get_untracked(&self) -> Option<T>where
T: 'static,
fn try_get_untracked(&self) -> Option<T>where
T: 'static,
Try to clone and return the current value stored in the Signal, and returns None
if it’s already disposed. It doesn’t subscribe to the current running effect.
Source§impl<T> SignalTrack<T> for Memo<T>
impl<T> SignalTrack<T> for Memo<T>
Source§impl<T> SignalWith<T> for Memo<T>
impl<T> SignalWith<T> for Memo<T>
Source§fn with<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn with<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
Applies a closure to the current value stored in the Signal, and subscribes
to the current running effect to this Memo.
Source§fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
Applies a closure to the current value stored in the Signal, but it doesn’t subscribe
to the current running effect.
impl<T> Copy for Memo<T>
Auto Trait Implementations§
impl<T> Freeze for Memo<T>
impl<T> RefUnwindSafe for Memo<T>where
T: RefUnwindSafe,
impl<T> Send for Memo<T>where
T: Send,
impl<T> Sync for Memo<T>where
T: Sync,
impl<T> Unpin for Memo<T>where
T: Unpin,
impl<T> UnwindSafe for Memo<T>where
T: UnwindSafe,
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