#[non_exhaustive]pub enum BindError {
MissingVariable {
name: VariableName,
},
EmptyVariable {
name: VariableName,
},
Environment {
name: VariableName,
source: EnvironmentError,
},
InvalidBoolean {
name: VariableName,
},
ParseVariable {
name: VariableName,
expected: &'static str,
},
Validation {
name: VariableName,
message: String,
},
ValueTooLarge {
name: VariableName,
max_bytes: usize,
},
}Expand description
Binding failure for one environment variable.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingVariable
Required variable missing.
Fields
name: VariableNameEnvironment variable name.
EmptyVariable
Required variable empty.
Fields
name: VariableNameEnvironment variable name.
Environment
Environment adapter failed during variable read.
InvalidBoolean
Boolean value invalid.
Fields
name: VariableNameEnvironment variable name.
ParseVariable
Parsed value invalid for the expected type.
Validation
Value failed validation.
ValueTooLarge
Raw value exceeded the configured byte limit.
Implementations§
Source§impl BindError
impl BindError
Sourcepub fn missing(name: impl Into<VariableName>) -> Self
pub fn missing(name: impl Into<VariableName>) -> Self
Build a missing-variable error.
Sourcepub fn empty(name: impl Into<VariableName>) -> Self
pub fn empty(name: impl Into<VariableName>) -> Self
Build an empty-variable error.
Sourcepub fn environment(
name: impl Into<VariableName>,
source: EnvironmentError,
) -> Self
pub fn environment( name: impl Into<VariableName>, source: EnvironmentError, ) -> Self
Build an environment adapter error.
Sourcepub fn invalid_boolean(name: impl Into<VariableName>) -> Self
pub fn invalid_boolean(name: impl Into<VariableName>) -> Self
Build a boolean parse error.
Sourcepub fn parse(name: impl Into<VariableName>, expected: &'static str) -> Self
pub fn parse(name: impl Into<VariableName>, expected: &'static str) -> Self
Build a typed parse error.
Sourcepub fn validation(name: impl Into<VariableName>, error: ValidationError) -> Self
pub fn validation(name: impl Into<VariableName>, error: ValidationError) -> Self
Build a validation error.
Sourcepub fn validation_with_sensitivity(
name: impl Into<VariableName>,
error: ValidationError,
sensitive: bool,
) -> Self
pub fn validation_with_sensitivity( name: impl Into<VariableName>, error: ValidationError, sensitive: bool, ) -> Self
Build a validation error, hiding custom details for sensitive values.
Sourcepub fn value_too_large(name: impl Into<VariableName>, max_bytes: usize) -> Self
pub fn value_too_large(name: impl Into<VariableName>, max_bytes: usize) -> Self
Build a value-size limit error.
Sourcepub fn variable_name(&self) -> &str
pub fn variable_name(&self) -> &str
Return the environment variable name associated with the error.
Sourcepub fn error_code(&self) -> &'static str
pub fn error_code(&self) -> &'static str
Return a stable error code.
Trait Implementations§
Source§impl Error for BindError
impl Error for BindError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl Eq for BindError
impl StructuralPartialEq for BindError
Auto Trait Implementations§
impl Freeze for BindError
impl RefUnwindSafe for BindError
impl Send for BindError
impl Sync for BindError
impl Unpin for BindError
impl UnsafeUnpin for BindError
impl UnwindSafe for BindError
Blanket Implementations§
Source§impl<B> BindingExt for B
impl<B> BindingExt for B
Source§fn optional(self) -> OptionalVar<Self>
fn optional(self) -> OptionalVar<Self>
None. Read more