pub struct CommandContext {
pub name: String,
pub args: String,
pub source: String,
pub uuid: String,
}Expand description
Details of a command invocation.
Fields§
§name: StringCommand name that was run, without the leading slash.
args: StringRaw argument string after the command name (empty if none).
source: StringName of the player (or console) that ran the command.
uuid: StringUUID of the executing entity (empty if run from the console).
Implementations§
Source§impl CommandContext
impl CommandContext
Sourcepub fn arg_list(&self) -> Vec<&str>
pub fn arg_list(&self) -> Vec<&str>
Arguments split on whitespace — for plain (untyped) commands.
Sourcepub fn typed_args(&self) -> Vec<&str>
pub fn typed_args(&self) -> Vec<&str>
Arguments split on \t — for typed commands registered with a schema.
Sourcepub fn arg_str(&self, idx: usize) -> Option<&str>
pub fn arg_str(&self, idx: usize) -> Option<&str>
The raw string of typed argument at idx, or None if out of range.
Sourcepub fn arg_player(&self, idx: usize) -> Option<&str>
pub fn arg_player(&self, idx: usize) -> Option<&str>
Typed argument idx as a player name, or None.
Trait Implementations§
Source§impl Clone for CommandContext
impl Clone for CommandContext
Source§fn clone(&self) -> CommandContext
fn clone(&self) -> CommandContext
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 moreAuto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnsafeUnpin for CommandContext
impl UnwindSafe for CommandContext
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