pub trait FromEnv:
Debug
+ Sized
+ 'static {
type Error: Error;
// Required method
fn from_env() -> Result<Self, FromEnvErr<Self::Error>>;
}Expand description
Trait for loading from the environment.
This trait is for structs or other complex objects, that need to be loaded from the environment. It expects that
- The struct is
Sizedand'static. - The struct elements can be parsed from strings.
- Struct elements are at fixed env vars, known by the type at compile time.
As such, unless the env is modified, these are essentially static runtime values.
Required Associated Types§
Required Methods§
Sourcefn from_env() -> Result<Self, FromEnvErr<Self::Error>>
fn from_env() -> Result<Self, FromEnvErr<Self::Error>>
Load from the environment.
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.