#[non_exhaustive]pub enum ValueError {
Missing(ValueMissing),
TypeMismatch {
expected: DataType,
actual: DataType,
},
Conversion(DataConversionError),
ListConversion(DataListConversionError),
}Expand description
Value processing error type
Defines various error conditions that may occur during value operations. Downstream matches must include a wildcard arm because this enum is non-exhaustive and may gain new error variants.
§Features
- Type mismatch error
- Structured missing-value errors
- Structured single-value conversion errors when
converteris enabled - Structured list conversion errors, including the failing item index, when
converteris enabled
§Examples
use qubit_datatype::DataType;
use qubit_value::{ValueError, ValueMissing};
let error = ValueError::Missing(ValueMissing::UnsetScalar {
data_type: DataType::String,
});
assert_eq!(error.to_string(), "Missing value: unset scalar with declared type string");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Missing(ValueMissing)
No concrete item is available from typed runtime storage or conversion.
Tuple Fields
§
0: ValueMissingStructured typed storage state that caused the missing value.
TypeMismatch
Type mismatch
Conversion(DataConversionError)
Error returned by the shared single-value conversion layer.
Tuple Fields
§
0: DataConversionErrorStructured conversion failure from qubit-datatype.
ListConversion(DataListConversionError)
Error returned by the shared list conversion layer.
Tuple Fields
§
0: DataListConversionErrorStructured list conversion failure, including the source index.
Implementations§
Source§impl ValueError
impl ValueError
Sourcepub const fn is_missing(&self) -> bool
pub const fn is_missing(&self) -> bool
Reports whether this error describes a missing value.
Sourcepub const fn missing(&self) -> Option<&ValueMissing>
pub const fn missing(&self) -> Option<&ValueMissing>
Returns the structured missing-value reason, when present.
Trait Implementations§
Source§impl Clone for ValueError
impl Clone for ValueError
Source§fn clone(&self) -> ValueError
fn clone(&self) -> ValueError
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 ValueError
impl Debug for ValueError
Source§impl Display for ValueError
impl Display for ValueError
impl Eq for ValueError
Source§impl Error for ValueError
impl Error for ValueError
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<DataConversionError> for ValueError
Available on crate feature converter only.
impl From<DataConversionError> for ValueError
Available on crate feature
converter only.Source§fn from(error: DataConversionError) -> Self
fn from(error: DataConversionError) -> Self
Converts to this type from the input type.
Source§impl From<DataListConversionError> for ValueError
Available on crate feature converter only.
impl From<DataListConversionError> for ValueError
Available on crate feature
converter only.Source§fn from(error: DataListConversionError) -> Self
fn from(error: DataListConversionError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ValueError
impl PartialEq for ValueError
impl StructuralPartialEq for ValueError
Auto Trait Implementations§
impl Freeze for ValueError
impl RefUnwindSafe for ValueError
impl Send for ValueError
impl Sync for ValueError
impl Unpin for ValueError
impl UnsafeUnpin for ValueError
impl UnwindSafe for ValueError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoValueDefault<T> for T
impl<T> IntoValueDefault<T> for T
Source§fn into_value_default(self) -> T
fn into_value_default(self) -> T
Converts this argument into the default value. Read more