pub struct CommandContext {
pub name: String,
pub args: String,
pub source: String,
pub uuid: String,
pub dimension: 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).
dimension: StringDimension the source is in, empty for console-run commands (no world).
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
Auto 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