pub struct Computed<T: Send + Sync + Clone + 'static> { /* private fields */ }Expand description
A lazily evaluated reactive value derived from signals or other computeds.
Computed<T> is a lightweight handle; clone it to share access to the same
derived node.
Implementations§
Source§impl<T: Send + Sync + Clone + 'static> Computed<T>
impl<T: Send + Sync + Clone + 'static> Computed<T>
Sourcepub fn get(&self) -> Result<T, ReactiveError>
pub fn get(&self) -> Result<T, ReactiveError>
Read the current value, recomputing if stale.
If called inside another computed thunk, registers the outer computed as a dependent of this one.
§Errors
ReactiveError::Cycle— this node is already on the evaluation stack (self-referential cycle).ReactiveError::DependencyCycle— registering a dep edge would introduce a graph cycle.ReactiveError::TypeMismatch— the cached value cannot be downcast toT(unreachable via the public API).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Computed<T>
impl<T> RefUnwindSafe for Computed<T>where
T: RefUnwindSafe,
impl<T> Send for Computed<T>
impl<T> Sync for Computed<T>
impl<T> Unpin for Computed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Computed<T>
impl<T> UnwindSafe for Computed<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