pub struct State<T: Clone + 'static> { /* private fields */ }Expand description
Cheap copyable read-only view of a state cell.
Implementations§
Source§impl<T: Clone + 'static> State<T>
impl<T: Clone + 'static> State<T>
pub fn is_alive(&self) -> bool
pub fn try_with<R>(&self, f: impl FnOnce(&T) -> R) -> Option<R>
pub fn try_value(&self) -> Option<T>
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn value(&self) -> T
pub fn get(&self) -> T
pub fn has_subscribers(&self) -> bool
pub fn on_subscriber(&self, callback: Rc<dyn Fn()>)
Trait Implementations§
impl<T: Clone + 'static> Copy for State<T>
impl<T: Clone + 'static> Eq for State<T>
Auto Trait Implementations§
impl<T> Freeze for State<T>
impl<T> RefUnwindSafe for State<T>
impl<T> Send for State<T>
impl<T> Sync for State<T>
impl<T> Unpin for State<T>
impl<T> UnsafeUnpin for State<T>
impl<T> UnwindSafe for State<T>
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