[−][src]Struct cmdmat::Mapping
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]
&mut self,
spec: &[Spec<'b, 'a, A, D, C>]
) -> Result<(), RegError>
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]
&mut self,
spec: Spec<'b, 'a, A, D, C>
) -> Result<(), RegError>
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]
&'b self,
input: &'b [&str]
) -> Result<MapOrDesc<'a, 'b, A, D, C>, LookError<D>>
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
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,