pub struct ParsableValueArgument<V> { /* private fields */ }
Expand description

Structure which defines how given argument should be handled. Allows for automatic parsing and validation. Mutable borrow to parsable argument definition has to be registered in ArgumentList. Because of that registered arguments cannot be used while those borrows exist. Either ArgumentList instance has to be dropped or there are no further usages of it. This method of defining arguments is preferred as oposed to using the legacy API.

Implementations§

source§

impl<V> ParsableValueArgument<V>

source

pub fn new<C>( identification: ArgumentIdentification, handler: C ) -> ParsableValueArgument<V>where C: Fn(&mut Peekable<&mut Iter<'_, String>>, &mut Vec<V>) -> Result<(), String> + 'static,

source

pub fn first_value(&self) -> Option<&V>

source

pub fn values(&self) -> &Vec<V>

source§

impl ParsableValueArgument<i64>

source

pub fn new_integer( identification: ArgumentIdentification ) -> ParsableValueArgument<i64>

Default integer type argument value handler. Checks whether value contains only digits or starts with minus sign.

source§

impl ParsableValueArgument<String>

source

pub fn new_string( identification: ArgumentIdentification ) -> ParsableValueArgument<String>

Default string type argument value handler.

Trait Implementations§

source§

impl<'a, V> HandleableArgument<'a> for ParsableValueArgument<V>

source§

fn handle( &mut self, input_iter: &mut Peekable<&mut Iter<'_, String>> ) -> Result<(), String>

Handles argument. Gets all needed values from input iterator.
source§

fn is_by_short(&self, name: char) -> bool

Check if this argument is identified by specified short name.
source§

fn is_by_long(&self, name: &str) -> bool

Check if this argument is identified by specified long name.
source§

fn identification(&self) -> &ArgumentIdentification

Get this arguments identification.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.