Enum shi::command::Command [−][src]
Command represents all and any command that should exist in shi. It represents a clear
bifurcation: a command is either a Leaf
or a Parent
command.
This refers to tree terminology; a command either has no children (subcommands) or it does.
Thus, it is either a Leaf command or a Parent
command, respectively.
Variants
Leaf(Box<dyn BaseCommand<State = S> + 'a>)
A command that has no sub commands. Conforms to BaseCommand
. Executes, unlike Parent
.
Parent(ParentCommand<'a, S>)
A command that has sub commands. A ParentCommand
does not execute.
Implementations
impl<'a, S> Command<'a, S>
[src]
pub fn new_leaf<C>(child_cmd: C) -> Self where
C: BaseCommand<State = S> + 'a,
[src]
C: BaseCommand<State = S> + 'a,
Creates a new Leaf
Command
from the given command.
pub fn new_parent(name: &'a str, sub_cmds: Vec<Command<'a, S>>) -> Self
[src]
Creates a new Parent
Command
from the given vector of sub commands.
Trait Implementations
impl<'a, S> BaseCommand for Command<'a, S>
[src]
type State = S
The State of the command. Expected to be bound to a containing Shell
.
fn name(&self) -> &str
[src]
fn validate_args(&self, args: &[String]) -> Result<()>
[src]
fn execute(&self, state: &mut Self::State, args: &[String]) -> Result<String>
[src]
fn help(&self) -> String
[src]
fn autocomplete(&self, _args: Vec<&str>, _trailing_space: bool) -> Completion
[src]
Auto Trait Implementations
impl<'a, S> !RefUnwindSafe for Command<'a, S>
impl<'a, S> !Send for Command<'a, S>
impl<'a, S> !Sync for Command<'a, S>
impl<'a, S> Unpin for Command<'a, S>
impl<'a, S> !UnwindSafe for Command<'a, S>
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,
pub 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, 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.
pub 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>,