Skip to main content

FromEnvStr

Trait FromEnvStr 

Source
pub trait FromEnvStr: Sized {
    type Err: Error + Send + Sync + 'static;

    // Required methods
    fn from_env_str(value: &str) -> Result<Self, Self::Err>;
    fn type_name() -> &'static str;

    // Provided method
    fn on_not_found(keys: &[&str]) -> Result<Self> { ... }
}

Required Associated Types§

Source

type Err: Error + Send + Sync + 'static

Required Methods§

Source

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source

fn type_name() -> &'static str

Provided Methods§

Source

fn on_not_found(keys: &[&str]) -> Result<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromEnvStr for bool

Source§

type Err = BoolParseError

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for f32

Source§

type Err = <f32 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for f64

Source§

type Err = <f64 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for i8

Source§

type Err = <i8 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for i16

Source§

type Err = <i16 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for i32

Source§

type Err = <i32 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for i64

Source§

type Err = <i64 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for i128

Source§

type Err = <i128 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for isize

Source§

type Err = <isize as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for u8

Source§

type Err = <u8 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for u16

Source§

type Err = <u16 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for u32

Source§

type Err = <u32 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for u64

Source§

type Err = <u64 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for u128

Source§

type Err = <u128 as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for usize

Source§

type Err = <usize as FromStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for String

Source§

type Err = Infallible

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl FromEnvStr for PathBuf

Source§

type Err = Infallible

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

impl<T: FromEnvStr> FromEnvStr for Option<T>

Source§

type Err = <T as FromEnvStr>::Err

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Source§

fn on_not_found(_keys: &[&str]) -> Result<Self>

Source§

impl<T: FromEnvStr> FromEnvStr for Vec<T>

Source§

type Err = VecParseError

Source§

fn from_env_str(value: &str) -> Result<Self, Self::Err>

Source§

fn type_name() -> &'static str

Implementors§