pub struct CommandMatcher<'a, T> { /* private fields */ }Expand description
Matches a string against a collection of command names.
Implementations§
Source§impl<'a, T> CommandMatcher<'a, T>
impl<'a, T> CommandMatcher<'a, T>
Sourcepub fn add(&mut self, command: &str, aux: T)
pub fn add(&mut self, command: &str, aux: T)
Consider command as a candidate for the command name being parsed. If
command is the correct command name, then get_match
will return aux later.
Sourcepub fn get_match(self) -> (Option<T>, isize)
pub fn get_match(self) -> (Option<T>, isize)
Returns the best match among the possibilities passed to add. Also returns the number of additional words that the caller should consider reading, because the full command name might be longer (if a command was returned) or because more words might be needed for disambiguation (if no command name was returned).
Auto Trait Implementations§
impl<'a, T> Freeze for CommandMatcher<'a, T>
impl<'a, T> RefUnwindSafe for CommandMatcher<'a, T>where
Option<T>: RefUnwindSafe,
impl<'a, T> Send for CommandMatcher<'a, T>
impl<'a, T> Sync for CommandMatcher<'a, T>
impl<'a, T> Unpin for CommandMatcher<'a, T>
impl<'a, T> UnsafeUnpin for CommandMatcher<'a, T>where
Option<T>: UnsafeUnpin,
impl<'a, T> UnwindSafe for CommandMatcher<'a, T>where
Option<T>: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more