Struct ParameterNode

Source
pub struct ParameterNode {
    pub node: TreeNode,
    pub required: bool,
    pub kind: ParameterKind,
}
Expand description

A node representing a parameter for a command.

Fields§

§node: TreeNode

TreeNode data.

§required: bool

A required parameter must be supplied for the command line being parsed to be valid.

§kind: ParameterKind

What type of ParameterKind this is.

Implementations§

Source§

impl ParameterNode

Source

pub fn new( name: &str, help_text: Option<&str>, hidden: bool, priority: i32, successors: Vec<Rc<Node>>, repeatable: bool, repeat_marker: Option<Rc<Node>>, kind: ParameterKind, required: bool, ) -> Self

Construct a new ParameterNode.

Trait Implementations§

Source§

impl NodeOps for ParameterNode

Source§

fn accept<'text>( &self, parser: &mut Parser<'text>, token: Token<'_>, _node_ref: &Rc<Node>, )

Record this parameter value.

Source§

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

By default named and simple parameters complete only to the token being input while flag parameters complete to the name of the flag.

Source§

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
Source§

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

By default, a node matches a token when the name of the node starts with the token. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.