TryFrom

Trait TryFrom 

Source
pub trait TryFrom<T>
where T: View, Self: View + Sized, Self::V: SpecTryFrom<T::V>,
{ type Error; // Required method exec fn ex_try_from(t: T) -> res : Result<Self, Self::Error>; }
Expand description

Vest equivalent of std::convert::TryFrom.

Required Associated Types§

Source

type Error

The type returned in the event of a conversion error.

Required Methods§

Source

exec fn ex_try_from(t: T) -> res : Result<Self, Self::Error>

ensures
res matches Ok(
    v,
) ==> {
    &&& Self::V::spec_try_from(t@) is Ok
    &&& Self::V::spec_try_from(t@) matches Ok(v_) && v@ == v_

},
res matches Err(e) ==> Self::V::spec_try_from(t@) is Err,

Vest equivalent of std::convert::TryFrom::try_from.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'x> TryFrom<&'x VarInt> for (&'x u8, Either<&'x &'x [u8], Either<&'x u16, Either<&'x u32, &'x u64>>>)

Source§

exec fn ex_try_from(t: &'x VarInt) -> Result<Self, Self::Error>

Source§

type Error = ()

Implementors§