pub enum FromEnvError {
Missing(String),
Invalid {
var: String,
value: String,
message: String,
},
}Expand description
Error returned by FromEnv::from_env.
§Example
let err = FromEnvError::missing("MY_VAR");
assert_eq!(err.to_string(), "environment variable `MY_VAR` is not set");
let err = FromEnvError::invalid("PORT", "abc", "invalid digit");
assert_eq!(
err.to_string(),
"environment variable `PORT` has invalid value `abc`: invalid digit"
);Variants§
Missing(String)
An environment variable was not set.
Invalid
An environment variable was set but could not be parsed.
Implementations§
Trait Implementations§
Source§impl Clone for FromEnvError
impl Clone for FromEnvError
Source§fn clone(&self) -> FromEnvError
fn clone(&self) -> FromEnvError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FromEnvError
impl Debug for FromEnvError
Source§impl Display for FromEnvError
impl Display for FromEnvError
Source§impl Error for FromEnvError
impl Error for FromEnvError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for FromEnvError
impl RefUnwindSafe for FromEnvError
impl Send for FromEnvError
impl Sync for FromEnvError
impl Unpin for FromEnvError
impl UnsafeUnpin for FromEnvError
impl UnwindSafe for FromEnvError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more