Enum env_parser::EnvType

source ·
pub enum EnvType {
    Bool(bool),
    I32(i32),
    I64(i64),
    I128(i128),
    U8(u8),
    U32(u32),
    U128(u128),
    F32(f32),
    F64(f64),
    USize(usize),
    StaticStr(String),
    Custom(Box<dyn CustomMap>),
}
Expand description

The different values an env file can hold

Variants§

§

Bool(bool)

§

I32(i32)

§

I64(i64)

§

I128(i128)

§

U8(u8)

§

U32(u32)

§

U128(u128)

§

F32(f32)

§

F64(f64)

§

USize(usize)

§

StaticStr(String)

§

Custom(Box<dyn CustomMap>)

Implementations§

source§

impl EnvType

source

pub fn rust_type(&self) -> String

The Rust type

source

pub fn raw_value(&self) -> String

The actual value the env property holds

source

pub fn value(&self) -> String

Adds the type if needed behind the raw value This is needed if the user wants the value 1 to be an f32. If you only type:

const MY_VARIABLE: f32 = 1;

The following compile error occurs: mismatched types [E0308] expected f32, found i32 That’s why the type is needed behind the value:

const MY_VARIABLE: f32 = 1f32;

Auto Trait Implementations§

§

impl !RefUnwindSafe for EnvType

§

impl !Send for EnvType

§

impl !Sync for EnvType

§

impl Unpin for EnvType

§

impl !UnwindSafe for EnvType

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>,

§

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>,

§

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.