pub struct Command<'a> {
    pub description: String,
    pub args_info: Vec<String>,
    pub handler: Box<Handler<'a>>,
}
Expand description

Single command that can be called in the REPL.

Though it is possible to construct it by manually, it is not advised. One should rather use the provided command! macro which will generate appropriate arguments validation and args_info based on passed specification.

Fields

description: String

Command desctiption that will be displayed in the help message

args_info: Vec<String>

Names and types of arguments to the command

handler: Box<Handler<'a>>

Command handler which should validate arguments and perform command logic

Implementations

Validate the arguments and invoke the handler if arguments are correct.

Returns the string description of the argument types

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.