Enum Value

Source
pub enum Value {
    Bool {
        value: bool,
    },
    Str {
        value: String,
    },
    Int {
        value: i32,
    },
    Float {
        value: f64,
    },
}
Expand description

Possible values for a CLI option.

Variants§

§

Bool

Fields

§value: bool
§

Str

Fields

§value: String
§

Int

Fields

§value: i32
§

Float

Fields

§value: f64

Implementations§

Source§

impl Value

Source

pub fn parse(option_type: &Type, input: &str) -> Result<Value>

Parse option value from string.

Source

pub fn from_default(option_type: &Type) -> Value

Create option value from default option value.

Source

pub fn bool(&self) -> Option<bool>

Get the boolean typed value.

Source

pub fn str(&self) -> Option<&String>

Get the string typed value.

Source

pub fn int(&self) -> Option<i32>

Get the integer typed value.

Source

pub fn float(&self) -> Option<f64>

Get the float typed value.

Trait Implementations§

Source§

impl Display for Value

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.