pub struct State<'r, T: Send + Sync + 'static>(_);
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.