pub struct State<'a> { /* private fields */ }
Implementations§
source§impl<'a> State<'a>
impl<'a> State<'a>
pub fn new(data: &'a Props, update: StateUpdate) -> Self
pub fn data(&self) -> &Props
pub fn has<T>(&self) -> boolwhere
T: 'static + PropsData,
pub fn read<T>(&self) -> Result<&'a T, StateError>where
T: 'static + PropsData,
pub fn map_or_default<T, R, F>(&self, f: F) -> R
pub fn map_or_else<T, R, F, E>(&self, f: F, e: E) -> R
pub fn read_cloned<T>(&self) -> Result<T, StateError>
pub fn read_cloned_or_default<T>(&self) -> T
pub fn read_cloned_or_else<T, F>(&self, f: F) -> T
pub fn write<T>(&self, data: T) -> Result<(), StateError>
pub fn write_with<T>(&self, data: T) -> Result<(), StateError>
pub fn write_without<T>(&self) -> Result<(), StateError>
pub fn mutate<T, F>(&self, f: F) -> Result<(), StateError>
pub fn mutate_cloned<T, F>(&self, f: F) -> Result<(), StateError>
pub fn update(&self) -> &StateUpdate
Auto Trait Implementations§
impl<'a> Freeze for State<'a>
impl<'a> !RefUnwindSafe for State<'a>
impl<'a> Send for State<'a>
impl<'a> Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> !UnwindSafe for State<'a>
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