[][src]Struct cmdmat::Mapping

pub struct Mapping<'a, A, D, C> { /* fields omitted */ }

Node in the matching tree

A Mapping is used to interface with cmdmat. Each node defines a point in a command tree, containing subcommands, deciders for argument parsing, and a finalizer if this mapping can be run.

Methods

impl<'a, A, D, C> Mapping<'a, A, D, C>[src]

pub fn register_many<'b>(
    &mut self,
    spec: &[Spec<'b, 'a, A, D, C>]
) -> Result<(), RegError>
[src]

Register many command specs at once, see Mapping::register for more detail

pub fn register<'b>(
    &mut self,
    spec: Spec<'b, 'a, A, D, C>
) -> Result<(), RegError>
[src]

Register a single command specification into the tree

The specification will be merged with existing command specifications, and may not overwrite commands with new deciders or finalizers. The overriding decider must be None to avoid an error.

pub fn lookup(&self, input: &[&str]) -> Result<FinWithArgs<A, C>, LookError<D>>[src]

Looks up a command and runs deciders to collect all arguments

pub fn get_direct_keys(&self) -> impl Iterator<Item = MappingEntry<A, D, C>>[src]

Iterator over the current Mapping keys: containing subcommands

pub fn partial_lookup<'b>(
    &'b self,
    input: &'b [&str]
) -> Result<MapOrDesc<'a, 'b, A, D, C>, LookError<D>>
[src]

Acquire any intermediate mapping, discards parsed inputs

pub fn decider(&self) -> &Option<&'a Decider<A, D>>[src]

Get the decider associated with this node

pub fn finalizer(&self) -> &Option<Finalizer<A, C>>[src]

Get the finalizer associated with this node

pub fn iter(&self) -> impl Iterator<Item = (&&'a str, &Mapping<'a, A, D, C>)>[src]

Iterator looping over all submappings

Trait Implementations

impl<'a, A, D, C> Default for Mapping<'a, A, D, C>[src]

Auto Trait Implementations

impl<'a, A, D, C> Send for Mapping<'a, A, D, C>

impl<'a, A, D, C> Unpin for Mapping<'a, A, D, C>

impl<'a, A, D, C> Sync for Mapping<'a, A, D, C>

impl<'a, A, D, C> UnwindSafe for Mapping<'a, A, D, C>

impl<'a, A, D, C> RefUnwindSafe for Mapping<'a, A, D, C>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for 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.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]