pub struct WeakState { /* private fields */ }
Expand description
Type to avoid Rc cyles on IncrState
Implementations§
Source§impl WeakState
impl WeakState
pub fn ptr_eq(&self, other: &Self) -> bool
pub fn strong_count(&self) -> usize
pub fn weak_count(&self) -> usize
Sourcepub fn upgrade(&self) -> Option<IncrState>
pub fn upgrade(&self) -> Option<IncrState>
Much like std::rc::Weak::upgrade.
NOTE: If you are using WeakState so that it can be stored inside an incremental (e.g.
incr.bind(move |_| weak_state.constant(5))
or observer.subscribe()
), then you need
to be a bit careful about what you do with that WeakState. Upgrading it just gives you
an IncrState, which is capable of calling stabilise
and panicking because you can’t
stabilise recursively. So it may be best to keep it as WeakState
, wherever possible.
pub fn fold<F, T: Value, R: Value>( &self, vec: Vec<Incr<T>>, init: R, f: F, ) -> Incr<R>
pub fn var<T: Value>(&self, value: T) -> Var<T>
pub fn var_current_scope<T: Value>(&self, value: T) -> Var<T>
pub fn within_scope<R>(&self, scope: Scope, f: impl FnOnce() -> R) -> R
pub fn current_scope(&self) -> Scope
pub fn save_dot_to_file(&self, named: &str)
pub fn save_dot_to_string(&self) -> String
pub fn unsubscribe(&self, token: SubscriptionToken)
Trait Implementations§
Source§impl PartialEq for WeakState
Implemented as pointer equality, like Weak::ptr_eq.
impl PartialEq for WeakState
Implemented as pointer equality, like Weak::ptr_eq.
Auto Trait Implementations§
impl Freeze for WeakState
impl !RefUnwindSafe for WeakState
impl !Send for WeakState
impl !Sync for WeakState
impl Unpin for WeakState
impl !UnwindSafe for WeakState
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