Struct sandkiste::errors::DatumConversionFailure
source · 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: D
Original datum that could not be converted
error: TypeMismatch
Error 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.