Arguments

Struct Arguments 

Source
pub struct Arguments(pub Vec<String>);
Expand description

Struct that contains the arguments provided by the user

Tuple Fields§

§0: Vec<String>

Implementations§

Source§

impl Arguments

Source

pub fn new() -> Arguments

Returns an Arguments struct that contains the arguments provided by the user with zigarg’s functionalities

Source

pub fn has_args(&self) -> bool

Returns true if the user provided arguments other than the program name

Source

pub fn len(&self) -> usize

Returns the lenght through usize of the Arguments struct

Source

pub fn eq(&self, num: usize) -> bool

Returns true if the number provided is equals to the number Arguments struct has

Source

pub fn get(&self, index: usize) -> Option<&String>

Returns a Some(&String) from the Arguments struct based on the provided index or None if not found

Source

pub fn get_value(&self, query: &str) -> Option<&String>

Returns value through Some('&String) of provided flag (not case sensitive) or None if not found

Source

pub fn get_value_case_sensitive(&self, query: &str) -> Option<&String>

Returns value through Some(&String) of provided flag (case sensitive) or None if not found

Source

pub fn get_index(&self, query: &str) -> Option<usize>

Returns index through Some(usize) of the &str slice provided from the Arguments struct or None if not found (not case sensitive)

Source

pub fn get_index_case_sensitive(&self, query: &str) -> Option<usize>

Returns index through Some(usize) of the &str slice provided from the Arguments struct or None if not found (case sensitive)

Source

pub fn exist(&self, query: &str) -> bool

Returns true if provided &str slice is found on any of the arguments provided by the user in the Arguments struct (not case sensitive)

Source

pub fn exist_case_sensitive(&self, query: &str) -> bool

Returns true if provided &str slice is found on any of the arguments provided by the user in the Arguments struct (case sensitive)

Source

pub fn get_after_index(&self, query: usize) -> Vec<String>

Returns the rest of the arguments based on provided index

Trait Implementations§

Source§

impl Debug for Arguments

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.