pub trait SpecTryFrom<T>: Sized {
type Error;
// Required method
spec fn spec_try_from(value: T) -> Result<Self, Self::Error>;
}Expand description
Spec version of TryFrom.
Required Associated Types§
Required Methods§
Sourcespec fn spec_try_from(value: T) -> Result<Self, Self::Error>
spec fn spec_try_from(value: T) -> Result<Self, Self::Error>
Performs the conversion.
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 SpecTryFrom<VarInt> for (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)
impl SpecTryFrom<VarInt> for (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)
Source§open spec fn spec_try_from(t: VarInt) -> Result<Self, Self::Error>
open spec fn spec_try_from(t: VarInt) -> Result<Self, Self::Error>
{
match t {
VarInt::U8(t) => Ok((t, inj_ord_choice_result!(Seq::< u8 >::empty(), *, *, *))),
VarInt::U16(x) => Ok((SPEC_TAG_U16, inj_ord_choice_result!(*, x, *, *))),
VarInt::U32(x) => Ok((SPEC_TAG_U32, inj_ord_choice_result!(*, *, x, *))),
VarInt::U64(x) => Ok((SPEC_TAG_U64, inj_ord_choice_result!(*, *, *, x))),
}
}