#[non_exhaustive]pub enum ConfigValueError {
InvalidBool {
value: String,
},
EmptyInteger,
InvalidInteger {
value: String,
},
IntegerOverflow {
value: String,
},
InvalidColor {
value: String,
},
}Expand description
Why a raw config value could not be read as a boolean, integer or color.
Returned by crate::config::parse_bool, crate::config::parse_i64 and
crate::config::parse_color, which see only the value. Readers that also know the key
(crate::config::ConfigSet::get_bool, crate::config::ConfigSet::get_i64) wrap it in
ConfigError::InvalidValue.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidBool
Not one of the boolean words (true/yes/on, false/no/off) or an integer.
EmptyInteger
An integer was required but the value is empty or only whitespace.
InvalidInteger
Not a decimal integer with an optional k/m/g suffix.
IntegerOverflow
The integer does not fit in an i64 once its k/m/g suffix is applied.
InvalidColor
Not a color specification (color names, numbers or #rrggbb, plus attributes).
Implementations§
Source§impl ConfigValueError
impl ConfigValueError
Sourcepub fn for_key(self, key: impl Into<String>) -> ConfigError
pub fn for_key(self, key: impl Into<String>) -> ConfigError
Attach the config key whose value was rejected.
§Parameters
key: the config key as the caller spelled it (for examplecore.bare).
§Returns
ConfigError::InvalidValue carrying key and this error as its source.
Trait Implementations§
Source§impl Clone for ConfigValueError
impl Clone for ConfigValueError
Source§impl Debug for ConfigValueError
impl Debug for ConfigValueError
Source§impl Display for ConfigValueError
impl Display for ConfigValueError
impl Eq for ConfigValueError
Source§impl Error for ConfigValueError
impl Error for ConfigValueError
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 ConfigValueError
impl PartialEq for ConfigValueError
impl StructuralPartialEq for ConfigValueError
Auto Trait Implementations§
impl Freeze for ConfigValueError
impl RefUnwindSafe for ConfigValueError
impl Send for ConfigValueError
impl Sync for ConfigValueError
impl Unpin for ConfigValueError
impl UnsafeUnpin for ConfigValueError
impl UnwindSafe for ConfigValueError
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
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§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.