pub enum ConfigError {
Show 14 variants
UnsupportedField {
field: String,
reason: String,
},
UnsupportedValue {
field: String,
reason: String,
},
MissingField {
field: String,
},
EmptyField {
field: String,
},
InvalidValue {
field: String,
reason: String,
},
InvalidFormat {
field: String,
expected: String,
},
Range {
field: String,
reason: String,
},
MutuallyExclusiveFields {
fields: Vec<String>,
},
RequiredOneOf {
fields: Vec<String>,
},
Dependency {
field: String,
depends_on: String,
reason: String,
},
Duplicate {
field: String,
value: Option<String>,
},
FeatureDisabled {
field: String,
feature: String,
},
InvalidReference {
field: String,
reference: String,
reason: String,
},
Multiple {
errors: Vec<Self>,
},
}Expand description
A typed configuration validation error with owned field paths.
Variants store owned field paths and explanatory text. Callers should avoid placing secrets in reason strings, reference names, or duplicate labels.
Variants§
UnsupportedField
A field is not supported by the current runtime.
UnsupportedValue
A field value is not supported by the current runtime.
MissingField
A required field is missing.
EmptyField
A required field is present but empty.
InvalidValue
A field value is invalid.
InvalidFormat
A field value has an invalid format.
Range
A field value is outside the accepted range.
MutuallyExclusiveFields
Fields were set together but are mutually exclusive.
RequiredOneOf
At least one of the listed fields is required.
Dependency
A field requires another field.
Duplicate
A field contains a duplicate entry.
FeatureDisabled
A field requires a disabled feature.
InvalidReference
A field references an invalid object.
Multiple
Multiple config validation errors were collected.
Implementations§
Source§impl ConfigError
impl ConfigError
Sourcepub fn unsupported_field(
field: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn unsupported_field( field: impl Into<String>, reason: impl Into<String>, ) -> Self
Creates an unsupported-field error.
Sourcepub fn unsupported_value(
field: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn unsupported_value( field: impl Into<String>, reason: impl Into<String>, ) -> Self
Creates an unsupported-value error.
Sourcepub fn missing_field(field: impl Into<String>) -> Self
pub fn missing_field(field: impl Into<String>) -> Self
Creates a missing-field error.
Sourcepub fn empty_field(field: impl Into<String>) -> Self
pub fn empty_field(field: impl Into<String>) -> Self
Creates an empty-field error.
Sourcepub fn invalid_value(
field: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_value( field: impl Into<String>, reason: impl Into<String>, ) -> Self
Creates an invalid-value error.
Sourcepub fn invalid_format(
field: impl Into<String>,
expected: impl Into<String>,
) -> Self
pub fn invalid_format( field: impl Into<String>, expected: impl Into<String>, ) -> Self
Creates an invalid-format error.
Sourcepub fn range(field: impl Into<String>, reason: impl Into<String>) -> Self
pub fn range(field: impl Into<String>, reason: impl Into<String>) -> Self
Creates a range error.
Sourcepub fn mutually_exclusive_fields(
fields: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn mutually_exclusive_fields( fields: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Creates a mutually-exclusive-fields error.
Sourcepub fn required_one_of(
fields: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn required_one_of( fields: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Creates a required-one-of error.
Sourcepub fn dependency(
field: impl Into<String>,
depends_on: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn dependency( field: impl Into<String>, depends_on: impl Into<String>, reason: impl Into<String>, ) -> Self
Creates a dependency error.
Sourcepub fn duplicate(field: impl Into<String>, value: Option<String>) -> Self
pub fn duplicate(field: impl Into<String>, value: Option<String>) -> Self
Creates a duplicate-entry error.
Sourcepub fn feature_disabled(
field: impl Into<String>,
feature: impl Into<String>,
) -> Self
pub fn feature_disabled( field: impl Into<String>, feature: impl Into<String>, ) -> Self
Creates a feature-disabled error.
Trait Implementations§
Source§impl Clone for ConfigError
impl Clone for ConfigError
Source§fn clone(&self) -> ConfigError
fn clone(&self) -> ConfigError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfigError
impl Debug for ConfigError
Source§impl Display for ConfigError
impl Display for ConfigError
impl Eq for ConfigError
Source§impl Error for ConfigError
impl Error for ConfigError
1.30.0 · 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()
Source§impl PartialEq for ConfigError
impl PartialEq for ConfigError
Source§fn eq(&self, other: &ConfigError) -> bool
fn eq(&self, other: &ConfigError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConfigError
Auto Trait Implementations§
impl Freeze for ConfigError
impl RefUnwindSafe for ConfigError
impl Send for ConfigError
impl Sync for ConfigError
impl Unpin for ConfigError
impl UnsafeUnpin for ConfigError
impl UnwindSafe for ConfigError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.