[−][src]Struct duckscript::types::command::Commands
Holds and enables access to the runtime commands implementations
Fields
commands: HashMap<String, CommandBox>
mapping between command names to implementations
aliases: HashMap<String, String>
mapping between aliases to command names
Methods
impl Commands
[src]
pub fn new() -> Commands
[src]
Creates and returns a new instance.
pub fn set(&mut self, command: CommandBox) -> Result<(), ScriptError>
[src]
Adds a new command definition. It will fail in case another command already defined the same name/aliases
pub fn get(&self, name: &str) -> Option<&CommandBox>
[src]
Return the command based on the given command name/alias
pub fn exists(&self, name: &str) -> bool
[src]
Return true if the command based on the given command name/alias exists
pub fn get_for_use(&mut self, name: &str) -> Option<CommandBox>
[src]
Return the command based on the given command name/alias. It will also remove it in the process.
pub fn get_all_command_names(&self) -> Vec<String>
[src]
Returns all the command names currently registered
pub fn remove(&mut self, name: &str) -> bool
[src]
Removes the requested command.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Commands
impl !Send for Commands
impl !Sync for Commands
impl Unpin for Commands
impl !UnwindSafe for Commands
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,