Struct Arg

Source
pub struct Arg(/* private fields */);
Expand description

A single, raw argument passed in from the command line.

This type is used in two ways: to indicate long command line options, and to indicate arguments themselves. For instance, given --target foo --path=bar input.txt, target, foo, path, bar, and input.txt would all be passed as Arg values to the relevant functions.

An Arg internally is just a byte slice, since that’s what the OS gives us. Callers can manually turn it into a str with from_utf8, and from there parse it however they need.

Implementations§

Source§

impl Arg

Source

pub const fn new(bytes: &[u8]) -> &Self

Source

pub const fn bytes(&self) -> &[u8]

Trait Implementations§

Source§

impl Debug for Arg

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Hash for Arg

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq<&[u8]> for Arg

Source§

fn eq(&self, other: &&[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<[u8]> for Arg

Source§

fn eq(&self, other: &[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for Arg

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Arg

Source§

fn eq(&self, other: &Arg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Arg

Source§

impl StructuralPartialEq for Arg

Auto Trait Implementations§

§

impl Freeze for Arg

§

impl RefUnwindSafe for Arg

§

impl Send for Arg

§

impl !Sized for Arg

§

impl Sync for Arg

§

impl Unpin for Arg

§

impl UnwindSafe for Arg

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