pub struct State<'r, T: Send + Sync + 'static>(/* private fields */);
Expand description
A guard for a state value.
See Manager::manage
for usage examples.
Implementations§
source§impl<'r, T: Send + Sync + 'static> State<'r, T>
impl<'r, T: Send + Sync + 'static> State<'r, T>
sourcepub fn inner(&self) -> &'r T
pub fn inner(&self) -> &'r T
Retrieve a borrow to the underlying value with a lifetime of 'r
.
Using this method is typically unnecessary as State
implements
std::ops::Deref
with a std::ops::Deref::Target
of T
.
Trait Implementations§
source§impl<'r, 'de: 'r, T: Send + Sync + 'static, R: Runtime> CommandArg<'de, R> for State<'r, T>
impl<'r, 'de: 'r, T: Send + Sync + 'static, R: Runtime> CommandArg<'de, R> for State<'r, T>
source§fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
Grabs the State
from the CommandItem
. This will never fail.
Auto Trait Implementations§
impl<'r, T> RefUnwindSafe for State<'r, T>where T: RefUnwindSafe,
impl<'r, T> Send for State<'r, T>
impl<'r, T> Sync for State<'r, T>
impl<'r, T> Unpin for State<'r, T>
impl<'r, T> UnwindSafe for State<'r, T>where T: RefUnwindSafe,
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