pub enum ValueCodecExecutionError {
TypeMismatch {
expected_type: &'static str,
actual_type: TypeId,
},
EncodeFailed {
codec_type: &'static str,
source: Box<dyn Error + Send + Sync + 'static>,
},
DecodeFailed {
codec_type: &'static str,
source: Box<dyn Error + Send + Sync + 'static>,
},
}Expand description
Failure produced by a type-erased value-codec invocation.
Registry lookups erase the concrete encoder and decoder types, so the
mismatch and failure they report are carried here as diagnostics instead of
a generic type parameter.
Source errors are retained as Send + Sync trait objects so this error can
cross thread boundaries without losing the concrete source type.
§Examples
use std::any::TypeId;
use qubit_codec::ValueCodecExecutionError;
let error = ValueCodecExecutionError::TypeMismatch {
expected_type: "u32",
actual_type: TypeId::of::<String>(),
};
assert_eq!(
error.to_string(),
format!("value codec for u32 received incompatible type {:?}", TypeId::of::<String>())
);Variants§
TypeMismatch
The supplied value has the wrong Rust type.
Fields
EncodeFailed
The typed encoder failed.
Fields
DecodeFailed
The typed decoder failed.
Trait Implementations§
Source§impl Debug for ValueCodecExecutionError
impl Debug for ValueCodecExecutionError
Source§impl Display for ValueCodecExecutionError
impl Display for ValueCodecExecutionError
Source§impl Error for ValueCodecExecutionError
impl Error for ValueCodecExecutionError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for ValueCodecExecutionError
impl !UnwindSafe for ValueCodecExecutionError
impl Forget for ValueCodecExecutionError
impl Freeze for ValueCodecExecutionError
impl Send for ValueCodecExecutionError
impl Sync for ValueCodecExecutionError
impl Unpin for ValueCodecExecutionError
impl UnsafeUnpin for ValueCodecExecutionError
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