pub struct CommandNode {
pub node: TreeNode,
pub handler: Option<fn(node: &Node)>,
pub parameters: Vec<Rc<Node>>,
pub wrapped_root: Option<Rc<Node>>,
}
Expand description
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
TreeNode
data.
handler: Option<fn(node: &Node)>
The handler which is executed once this node has been accepted.
parameters: Vec<Rc<Node>>
Parameter nodes for this command
wrapped_root: Option<Rc<Node>>
If present, the command wrapped by this node.
Implementations§
Trait Implementations§
Source§impl NodeOps for CommandNode
impl NodeOps for CommandNode
Source§fn accept<'text>(
&self,
parser: &mut Parser<'text>,
_token: Token<'_>,
node_ref: &Rc<Node>,
)
fn accept<'text>( &self, parser: &mut Parser<'text>, _token: Token<'_>, node_ref: &Rc<Node>, )
Record this command.
Source§fn acceptable(&self, parser: &Parser<'_>, node_ref: &Rc<Node>) -> bool
fn acceptable(&self, parser: &Parser<'_>, node_ref: &Rc<Node>) -> bool
Can this node be accepted in the current parser state?
By default, a node can be accepted when it hasn’t been seen yet. Read more
Auto Trait Implementations§
impl Freeze for CommandNode
impl RefUnwindSafe for CommandNode
impl !Send for CommandNode
impl !Sync for CommandNode
impl Unpin for CommandNode
impl UnwindSafe for CommandNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more