pub struct StateRef<G, T, S> { /* private fields */ }Expand description
Immutable shared-state read guard used as State storage.
This is the inner value for StorageStateRef. Public shared immutable
borrows return State<StorageStateRef<...>, T, S>, not this type directly.
The storage implements SRef but deliberately does not implement
SMut, so read-only arbitrary-self methods can run while generated
transition calls cannot complete.
ⓘ
let connected = shared.borrow::<Connected>()?;
assert_eq!(connected.endpoint(), "localhost:8080"); // `self: &State<impl SRef, ...>`
// Union borrows work too; the runtime marker is checked against the union.
let online = shared.borrow::<Online>()?;Trait Implementations§
Auto Trait Implementations§
impl<G, T, S> Freeze for StateRef<G, T, S>where
G: Freeze,
impl<G, T, S> RefUnwindSafe for StateRef<G, T, S>where
G: RefUnwindSafe,
impl<G, T, S> Send for StateRef<G, T, S>where
G: Send,
impl<G, T, S> StateClone for StateRef<G, T, S>where
G: StateClone,
impl<G, T, S> StateCopy for StateRef<G, T, S>where
G: StateCopy,
impl<G, T, S> Sync for StateRef<G, T, S>where
G: Sync,
impl<G, T, S> Unpin for StateRef<G, T, S>where
G: Unpin,
impl<G, T, S> UnsafeUnpin for StateRef<G, T, S>where
G: UnsafeUnpin,
impl<G, T, S> UnwindSafe for StateRef<G, T, S>where
G: UnwindSafe,
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