pub struct CommandContext<'context> {
inner: &'context CommandContext<CommandSource, SteelCommandRuntime>,
}Expand description
A parsed command invocation exposed to an extension executor.
Fields§
§inner: &'context CommandContext<CommandSource, SteelCommandRuntime>Implementations§
Source§impl<'context> CommandContext<'context>
impl<'context> CommandContext<'context>
Sourcepub fn source(self) -> CommandSource<'context>
pub fn source(self) -> CommandSource<'context>
Returns the execution source.
Sourcepub fn value<T: DowncastType>(self, name: &str) -> Option<&'context T>
pub fn value<T: DowncastType>(self, name: &str) -> Option<&'context T>
Returns a parsed custom value by its deterministic concrete type key.
Sourcepub fn boolean(self, name: &str) -> Option<bool>
pub fn boolean(self, name: &str) -> Option<bool>
Returns a parsed boolean, or None when the named argument has another type.
Sourcepub fn string(self, name: &str) -> Option<&'context str>
pub fn string(self, name: &str) -> Option<&'context str>
Returns a parsed word, phrase, or greedy string.
Sourcepub fn domain(self, name: &str) -> Option<&'context str>
pub fn domain(self, name: &str) -> Option<&'context str>
Returns a parsed configured domain name.
Sourcepub fn world(self, name: &str) -> Result<Arc<World>, CommandError>
pub fn world(self, name: &str) -> Result<Arc<World>, CommandError>
Resolves a parsed loaded-world argument against the current source domain.
Sourcepub fn players(self, name: &str) -> Result<Vec<Arc<Player>>, CommandError>
pub fn players(self, name: &str) -> Result<Vec<Arc<Player>>, CommandError>
Resolves a player selector and requires at least one result.
Sourcepub fn player(self, name: &str) -> Result<Arc<Player>, CommandError>
pub fn player(self, name: &str) -> Result<Arc<Player>, CommandError>
Resolves a single player selector.
Sourcepub fn entities(self, name: &str) -> Result<Vec<SharedEntity>, CommandError>
pub fn entities(self, name: &str) -> Result<Vec<SharedEntity>, CommandError>
Resolves an entity selector and requires at least one result.
Sourcepub fn entity(self, name: &str) -> Result<SharedEntity, CommandError>
pub fn entity(self, name: &str) -> Result<SharedEntity, CommandError>
Resolves a single entity selector.
Trait Implementations§
Source§impl<'context> Clone for CommandContext<'context>
impl<'context> Clone for CommandContext<'context>
Source§fn clone(&self) -> CommandContext<'context>
fn clone(&self) -> CommandContext<'context>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'context> Copy for CommandContext<'context>
Auto Trait Implementations§
impl<'context> !RefUnwindSafe for CommandContext<'context>
impl<'context> !UnwindSafe for CommandContext<'context>
impl<'context> Freeze for CommandContext<'context>
impl<'context> Send for CommandContext<'context>
impl<'context> Sync for CommandContext<'context>
impl<'context> Unpin for CommandContext<'context>
impl<'context> UnsafeUnpin for CommandContext<'context>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>