pub struct Command(_);Expand description
A compiled command that can be used to match text.
Implementations
sourceimpl Command
impl Command
sourcepub fn get_matches<'c, 't>(&'c self, s: &'t str) -> Option<Args<'c, 't>>
pub fn get_matches<'c, 't>(&'c self, s: &'t str) -> Option<Args<'c, 't>>
Match this Command to the given text, returning captures if any.
sourcepub fn has_prefix(&self, s: &str) -> bool
pub fn has_prefix(&self, s: &str) -> bool
Returns true if the command matches the string at least partially.
This is equivalent to a command composed of only the first Segment of
self matching the string and checking that it is Some.
Examples
let cmd = malachi::Command::new("?eval <code: starts('```'), ends('```')>")?;
// This text won't match but has the correct prefix.
let text = "?eval 4";
assert_eq!(cmd.get_matches(text), None);
assert!(cmd.has_prefix(text));Trait Implementations
impl Eq for Command
impl StructuralEq for Command
impl StructuralPartialEq for Command
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more