pub trait FromEnvVar:
Debug
+ Sized
+ 'static {
type Error: Error;
// Required method
fn from_env_var(env_var: &str) -> Result<Self, FromEnvErr<Self::Error>>;
}Expand description
Trait for loading primitives from the environment. These are simple types
that should correspond to a single environment variable. It has been
implemented for common integer types, String, url::Url,
tracing::Level, and std::time::Duration.
It aims to make FromEnv implementations easier to write, by providing a
default implementation for common types.
Required Associated Types§
Required Methods§
Sourcefn from_env_var(env_var: &str) -> Result<Self, FromEnvErr<Self::Error>>
fn from_env_var(env_var: &str) -> Result<Self, FromEnvErr<Self::Error>>
Load the primitive from the environment at the given variable.
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.