pub struct SnapshotState<T>where
T: Clone + 'static,{ /* private fields */ }Expand description
Cheap copyable mutable view of a state cell.
Ownership lives elsewhere: a composition slot, an OwnedMutableState, or
the runtime for states created with crate::mutableStateOf /
MutableState::with_runtime.
Implementations§
Source§impl<T> MutableState<T>where
T: Clone + 'static,
impl<T> MutableState<T>where
T: Clone + 'static,
pub fn with_runtime(value: T, runtime: RuntimeHandle) -> MutableState<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 as_state(&self) -> State<T>
pub fn try_retain(&self) -> Option<OwnedMutableState<T>>
pub fn retain(&self) -> OwnedMutableState<T>
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn update<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
pub fn replace(&self, value: T)
pub fn set_value(&self, value: T)
pub fn set(&self, value: T)
pub fn value(&self) -> T
pub fn get(&self) -> T
pub fn get_non_reactive(&self) -> T
Trait Implementations§
Source§impl<T> Clone for MutableState<T>where
T: Clone + 'static,
impl<T> Clone for MutableState<T>where
T: Clone + 'static,
Source§fn clone(&self) -> MutableState<T>
fn clone(&self) -> MutableState<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for MutableState<T>
impl<T> Debug for MutableState<T>
Source§impl<T> PartialEq for MutableState<T>where
T: Clone + 'static,
impl<T> PartialEq for MutableState<T>where
T: Clone + 'static,
impl<T> Copy for MutableState<T>where
T: Clone + 'static,
impl<T> Eq for MutableState<T>where
T: Clone + 'static,
Auto Trait Implementations§
impl<T> Freeze for MutableState<T>
impl<T> RefUnwindSafe for MutableState<T>
impl<T> Send for MutableState<T>
impl<T> Sync for MutableState<T>
impl<T> Unpin for MutableState<T>
impl<T> UnsafeUnpin for MutableState<T>
impl<T> UnwindSafe for MutableState<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