Struct commands::parser::CommandNode [] [src]

pub struct CommandNode {
    pub node: TreeNode,
    pub handler: Option<fn(node: Node)>,
    pub parameters: Vec<Rc<Node>>,
    pub wrapped_root: Option<Rc<Node>>,
}

A node representing a command. Constructed via Command and CommandTree.

If wrapped_root is set then this node wraps another command. This is used for the help command so that it can complete normal commands. The successors will be those of the wrapped node.

Fields

node

TreeNode data.

handler

The handler which is executed once this node has been accepted.

parameters

Parameter nodes for this command

wrapped_root

If present, the command wrapped by this node.

Methods

impl CommandNode

fn new(name: &str, help_text: Option<&str>, hidden: bool, priority: i32, successors: Vec<Rc<Node>>, handler: Option<fn(node: Node)>, parameters: Vec<Rc<Node>>) -> Self

Construct a new CommandNode.

Trait Implementations

impl NodeOps for CommandNode

fn accept<'text>(&self, parser: &mut Parser<'text>, _token: Token, node_ref: &Rc<Node>)

fn acceptable(&self, parser: &Parser, node_ref: &Rc<Node>) -> bool

fn complete<'text>(&self, token: Option<Token<'text>>) -> Completion<'text>

fn matches(&self, _parser: &Parser, token: Token) -> bool