Struct ArgumentTraverser

Source
pub struct ArgumentTraverser<'cmd> { /* private fields */ }
Expand description

Iterates over the individual arguments in a command accounting for quoted arguments.

Implementations§

Source§

impl<'cmd> ArgumentTraverser<'cmd>

Source

pub fn new(command: &'cmd str) -> Self

Creates a traverser over the given command, stripping off the initial ‘/’ if it exists.

Source

pub fn gobble_remaining(&mut self) -> &'cmd str

Returns the remaining portion of the string being traversed, including the argument which was last read.

Source

pub fn gobble_remaining_truncated(&self, truncate_to: usize) -> &'cmd str

Returns the remaining portion of the string being traversed from the current anchor position to the end of the string.

Source

pub fn has_next(&self) -> bool

Returns whether or not this traverser has more arguments. If this function returns true, then next will not return None.

Source

pub fn next(&mut self) -> Option<&'cmd str>

Returns the next argument in the string being traversed, or None if no arguments remain. This function will not strip strings of any enclosing quotes, and will not resolve escape sequences.

Auto Trait Implementations§

§

impl<'cmd> Freeze for ArgumentTraverser<'cmd>

§

impl<'cmd> RefUnwindSafe for ArgumentTraverser<'cmd>

§

impl<'cmd> Send for ArgumentTraverser<'cmd>

§

impl<'cmd> Sync for ArgumentTraverser<'cmd>

§

impl<'cmd> Unpin for ArgumentTraverser<'cmd>

§

impl<'cmd> UnwindSafe for ArgumentTraverser<'cmd>

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.