pub struct DatumConversionFailure<D> {
pub original: D,
pub error: TypeMismatch,
}Expand description
Error type when using TryFrom/TryInto to convert a
Machine::Datum into a particular type
See also types module.
Since this type contains the original Datum, it might not be
Send + Sync + 'static. DatumConversionFailure also does not implement
std::error::Error. You can convert this error into TypeMismatch
(or extract the error field), which implements std::error::Error and
is Send + Sync + 'static.
For convenience, values of this type can also be directly converted into a
MachineError.
Fields§
§original: DOriginal datum that could not be converted
error: TypeMismatchError description
Implementations§
Source§impl<D> DatumConversionFailure<D>
impl<D> DatumConversionFailure<D>
Sourcepub fn new(original: D, error: TypeMismatch) -> Self
pub fn new(original: D, error: TypeMismatch) -> Self
Create new DatumConversionFailure with given TypeMismatch error
Sourcepub fn with_msg(original: D, message: String) -> Self
pub fn with_msg(original: D, message: String) -> Self
Create new DatumConversionFailure with owned String error message
Sourcepub fn with_static_msg(original: D, message: &'static str) -> Self
pub fn with_static_msg(original: D, message: &'static str) -> Self
Create new DatumConversionFailure with static error message
Trait Implementations§
Source§impl<D> Debug for DatumConversionFailure<D>
impl<D> Debug for DatumConversionFailure<D>
Source§impl<D> From<DatumConversionFailure<D>> for MachineError
impl<D> From<DatumConversionFailure<D>> for MachineError
Source§fn from(failure: DatumConversionFailure<D>) -> Self
fn from(failure: DatumConversionFailure<D>) -> Self
Converts to this type from the input type.
Source§impl<D> From<DatumConversionFailure<D>> for TypeMismatch
impl<D> From<DatumConversionFailure<D>> for TypeMismatch
Source§fn from(failure: DatumConversionFailure<D>) -> Self
fn from(failure: DatumConversionFailure<D>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<D> Freeze for DatumConversionFailure<D>where
D: Freeze,
impl<D> RefUnwindSafe for DatumConversionFailure<D>where
D: RefUnwindSafe,
impl<D> Send for DatumConversionFailure<D>where
D: Send,
impl<D> Sync for DatumConversionFailure<D>where
D: Sync,
impl<D> Unpin for DatumConversionFailure<D>where
D: Unpin,
impl<D> UnwindSafe for DatumConversionFailure<D>where
D: UnwindSafe,
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