[−][src]Struct msgpack_simple::ConversionError
An error that occurred when trying to access a field as a different type
The "as_type" functions of MsgPack can throw this error. It contains the original object and a string representation of the attempted conversion.
Fields
original: MsgPack
The original object, owned.
attempted: &'static str
A string that contains which type conversion was attempted.
Implementations
impl ConversionError
[src]
pub fn recover(self) -> MsgPack
[src]
Recovers the MsgPack object from the error
use msgpack_simple::MsgPack; let float = MsgPack::Float(42.0); let error = float.as_int().unwrap_err(); // trigger and capture an error let recovered = error.recover(); assert!(recovered.is_float()); assert_eq!(recovered.as_float().unwrap(), 42.0);
Trait Implementations
impl Debug for ConversionError
[src]
impl Display for ConversionError
[src]
impl Error for ConversionError
[src]
Auto Trait Implementations
impl RefUnwindSafe for ConversionError
impl Send for ConversionError
impl Sync for ConversionError
impl Unpin for ConversionError
impl UnwindSafe for ConversionError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,