pub struct State<'a> { /* private fields */ }
Implementations§
source§impl<'a> State<'a>
impl<'a> State<'a>
pub fn new(data: &'a Props, update: StateUpdate) -> State<'a>
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) -> Rwhere T: 'static + PropsData, R: Default, F: FnMut(&T) -> R,
pub fn map_or_else<T, R, F, E>(&self, f: F, e: E) -> Rwhere T: 'static + PropsData, F: FnMut(&T) -> R, E: FnMut() -> R,
pub fn read_cloned<T>(&self) -> Result<T, StateError>where T: 'static + PropsData + Clone,
pub fn read_cloned_or_default<T>(&self) -> Twhere T: 'static + PropsData + Clone + Default,
pub fn read_cloned_or_else<T, F>(&self, f: F) -> Twhere T: 'static + PropsData + Clone + Default, F: FnMut() -> T,
pub fn write<T>(&self, data: T) -> Result<(), StateError>where T: 'static + PropsData + Send + Sync,
pub fn write_with<T>(&self, data: T) -> Result<(), StateError>where T: 'static + PropsData + Send + Sync,
pub fn write_without<T>(&self) -> Result<(), StateError>where T: 'static + PropsData + Send + Sync,
pub fn mutate<T, F>(&self, f: F) -> Result<(), StateError>where T: 'static + PropsData + Send + Sync, F: FnMut(&T) -> T,
pub fn mutate_cloned<T, F>(&self, f: F) -> Result<(), StateError>where T: 'static + PropsData + Send + Sync + Clone, F: FnMut(&mut T),
pub fn update(&self) -> &StateUpdate
Auto Trait Implementations§
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