Enum shi::command::Command[][src]

pub enum Command<'a, S> {
    Leaf(Box<dyn BaseCommand<State = S> + 'a>),
    Parent(ParentCommand<'a, S>),
}

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]

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.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.