pub enum ValueConversionError {
TypeMismatch {
expected: ValueType,
actual: ValueType,
},
MissingField(String),
InvalidValue(String),
OutOfRange(String),
Custom(String),
}Expand description
Error that occurs during value conversion.
Variants§
TypeMismatch
Type mismatch during conversion.
MissingField(String)
Missing required field in map.
InvalidValue(String)
Invalid value for the target type.
OutOfRange(String)
Out of range for numeric conversion.
Custom(String)
Custom conversion error.
Implementations§
Source§impl ValueConversionError
impl ValueConversionError
Sourcepub fn type_mismatch(expected: ValueType, actual: ValueType) -> Self
pub fn type_mismatch(expected: ValueType, actual: ValueType) -> Self
Create a type mismatch error.
Sourcepub fn missing_field(field: impl Into<String>) -> Self
pub fn missing_field(field: impl Into<String>) -> Self
Create a missing field error.
Sourcepub fn invalid_value(msg: impl Into<String>) -> Self
pub fn invalid_value(msg: impl Into<String>) -> Self
Create an invalid value error.
Sourcepub fn out_of_range(msg: impl Into<String>) -> Self
pub fn out_of_range(msg: impl Into<String>) -> Self
Create an out of range error.
Trait Implementations§
Source§impl Clone for ValueConversionError
impl Clone for ValueConversionError
Source§fn clone(&self) -> ValueConversionError
fn clone(&self) -> ValueConversionError
Returns a duplicate of the value. Read more
1.0.0 · 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 ValueConversionError
impl Debug for ValueConversionError
Source§impl Display for ValueConversionError
impl Display for ValueConversionError
Source§impl Error for ValueConversionError
impl Error for ValueConversionError
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()
Source§impl From<ValueConversionError> for Error
impl From<ValueConversionError> for Error
Source§fn from(source: ValueConversionError) -> Self
fn from(source: ValueConversionError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ValueConversionError
impl PartialEq for ValueConversionError
impl StructuralPartialEq for ValueConversionError
Auto Trait Implementations§
impl Freeze for ValueConversionError
impl RefUnwindSafe for ValueConversionError
impl Send for ValueConversionError
impl Sync for ValueConversionError
impl Unpin for ValueConversionError
impl UnwindSafe for ValueConversionError
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