Struct RawValues

pub struct RawValues<'a> { /* private fields */ }

Iterate over raw argument values via ArgMatches::get_raw.

Examples

# #[cfg(unix)] {
# use clap_builder as clap;
# use clap::{Command, arg, value_parser};
use std::ffi::OsString;
use std::os::unix::ffi::{OsStrExt,OsStringExt};

let m = Command::new("utf8")
    .arg(arg!(<arg> "some arg")
        .value_parser(value_parser!(OsString)))
    .get_matches_from(vec![OsString::from("myprog"),
                            // "Hi {0xe9}!"
                            OsString::from_vec(vec![b'H', b'i', b' ', 0xe9, b'!'])]);
assert_eq!(
    &*m.get_raw("arg")
        .unwrap()
        .next().unwrap()
        .as_bytes(),
    [b'H', b'i', b' ', 0xe9, b'!']
);
# }

Trait Implementations

impl Default for RawValues<'_>

fn default() -> Self

impl ExactSizeIterator for RawValues<'_>

impl<'a> Clone for RawValues<'a>

fn clone(&self) -> RawValues<'a>

impl<'a> Debug for RawValues<'a>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'a> DoubleEndedIterator for RawValues<'a>

fn next_back(&mut self) -> Option<&'a OsStr>

impl<'a> Iterator for RawValues<'a>

type Item = &'a OsStr;
fn next(&mut self) -> Option<&'a OsStr>
fn size_hint(&self) -> (usize, Option<usize>)

Auto Trait Implementations

impl<'a> Freeze for RawValues<'a>

impl<'a> RefUnwindSafe for RawValues<'a>

impl<'a> Send for RawValues<'a>

impl<'a> Sync for RawValues<'a>

impl<'a> Unpin for RawValues<'a>

impl<'a> UnsafeUnpin for RawValues<'a>

impl<'a> UnwindSafe for RawValues<'a>

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for RawValues<'a> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for RawValues<'a> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for RawValues<'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 RawValues<'a> where U: Into<T>,

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

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

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