Struct shi::command::basic::BasicCommand[][src]

pub struct BasicCommand<'a, S> { /* fields omitted */ }

A BasicCommand is a very simple command type. It has a name, and it has a closure that it executes when it is invoked. The closure takes a state, as determined by its containing shell, and a vector of String arguments.

Implementations

impl<'a, S> BasicCommand<'a, S>[src]

pub fn new<F>(name: &'a str, exec: F) -> BasicCommand<'a, S> where
    F: Fn(&mut S, &[String]) -> Result<String> + 'static, 
[src]

Creates a new BasicCommand with the given name and closure.

Arguments

  • name - The name of the command. This is how users will execute the command.
  • exec - The closure that will be executed when this command is invoked.

pub fn new_with_help<F>(
    name: &'a str,
    help: &'a str,
    exec: F
) -> BasicCommand<'a, S> where
    F: Fn(&mut S, &[String]) -> Result<String> + 'static, 
[src]

Creates a new BasicCommand with the given name, closure and help message.

Arguments

  • name - The name of the command. This is how users will execute the command.
  • exec - The closure that will be executed when this command is invoked.
  • help - The help message to use.

Trait Implementations

impl<'a, S> BaseCommand for BasicCommand<'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 BasicCommand<'a, S>

impl<'a, S> !Send for BasicCommand<'a, S>

impl<'a, S> !Sync for BasicCommand<'a, S>

impl<'a, S> Unpin for BasicCommand<'a, S>

impl<'a, S> !UnwindSafe for BasicCommand<'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.