pub struct StateContext<'a> { /* private fields */ }Expand description
Pure state context with automatic patch collection.
Implementations§
Source§impl<'a> StateContext<'a>
impl<'a> StateContext<'a>
Sourcepub fn state<T: State>(&self, path: &str) -> T::Ref<'_>
pub fn state<T: State>(&self, path: &str) -> T::Ref<'_>
Get a typed state reference at the specified path.
Sourcepub fn state_of<T: State>(&self) -> T::Ref<'_>
pub fn state_of<T: State>(&self) -> T::Ref<'_>
Get a typed state reference at the type’s canonical path.
Requires T to have #[tirea(path = "...")] set.
Panics if T::PATH is empty.
Sourcepub fn take_patch(&self) -> Patch
pub fn take_patch(&self) -> Patch
Extract collected operations as a plain patch.
Sourcepub fn take_tracked_patch(&self, source: impl Into<String>) -> TrackedPatch
pub fn take_tracked_patch(&self, source: impl Into<String>) -> TrackedPatch
Extract collected operations as a tracked patch with a source.
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Check if any operations have been collected.
Auto Trait Implementations§
impl<'a> !Freeze for StateContext<'a>
impl<'a> RefUnwindSafe for StateContext<'a>
impl<'a> Send for StateContext<'a>
impl<'a> Sync for StateContext<'a>
impl<'a> Unpin for StateContext<'a>
impl<'a> UnwindSafe for StateContext<'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