Struct Shlex

pub struct Shlex<'a> { pub line_no: usize, pub had_error: bool, /* private fields */ }

An iterator that takes an input byte string and splits it into the words using the same syntax as the POSIX shell.

Fields

line_no: usize

The number of newlines read so far, plus one.

had_error: bool

An input string is erroneous if it ends while inside a quotation or right after an unescaped backslash. Since Iterator does not have a mechanism to return an error, if that happens, Shlex just throws out the last token, ends the iteration, and sets 'had_error' to true; best to check it after you're done iterating.

Implementations

impl<'a> Shlex<'a>

fn new(in_bytes: &'a [u8]) -> Self

Trait Implementations

impl Iterator for Shlex<'_>

type Item = Vec<u8>;
fn next(&mut self) -> Option<Self::Item>

Auto Trait Implementations

impl<'a> Freeze for Shlex<'a>

impl<'a> RefUnwindSafe for Shlex<'a>

impl<'a> Send for Shlex<'a>

impl<'a> Sync for Shlex<'a>

impl<'a> Unpin for Shlex<'a>

impl<'a> UnsafeUnpin for Shlex<'a>

impl<'a> UnwindSafe for Shlex<'a>

Blanket Implementations

impl<I> IntoIterator for Shlex<'a> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for Shlex<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Shlex<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Shlex<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Shlex<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Shlex<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Shlex<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Shlex<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>