pub trait ParseEnv: Sized {
type Err: Display;
// Required method
fn parse_env(value: String) -> Result<Self, Self::Err>;
}
Expand description
Define the parsing function for a type from a String
environment variable.
Check the source for the builtin type definitions for this trait if you’re concerned about the parsing logic.
Required Associated Types§
Required Methods§
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 ParseEnv for SocketAddr
impl ParseEnv for SocketAddr
Source§impl ParseEnv for bool
bool
allows two common conventions:
impl ParseEnv for bool
bool
allows two common conventions:
- String either “true” or “false” (case insensitive)
- Integer either 0 or 1
Anything else will result in a ParseError
.
Source§impl<T> ParseEnv for Vec<T>where
T: ParseEnv,
Vec<T>
is by default parsed as comma-separated values.
impl<T> ParseEnv for Vec<T>where
T: ParseEnv,
Vec<T>
is by default parsed as comma-separated values.