pub struct MutableState<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: Clone + 'static> MutableState<T>
impl<T: Clone + 'static> MutableState<T>
pub fn with_runtime(value: T, runtime: RuntimeHandle) -> Self
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 + 'static> Clone for MutableState<T>
impl<T: Clone + 'static> Clone for MutableState<T>
Source§impl<T: Clone + 'static> PartialEq for MutableState<T>
impl<T: Clone + 'static> PartialEq for MutableState<T>
impl<T: Clone + 'static> Copy for MutableState<T>
impl<T: Clone + 'static> Eq for MutableState<T>
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