pub trait BTryFrom<T>: Sized {
type Error;
// Required method
fn try_from(from: T) -> Result<Self, Self::Error>;
}
Expand description
Trait for fallible conversions between bnum
integer types.
Unfortunately, TryFrom
cannot currently be used for conversions between bnum
integers, since TryFrom<T> for T
is already implemented by the standard library (and so it is not possible to implement TryFrom<BUint<M>> for BUint<N>
). When the generic_const_exprs
feature becomes stabilised, it may be possible to use TryFrom
instead of BTryFrom
. BTryFrom
is designed to have the same behaviour as TryFrom
for conversions between two primitive types, and conversions between a primitive type and a bnum type. BTryFrom
is a workaround for the issue described above, and so you should not implement it yourself. It should only be used for conversions between bnum
integers.
Required Associated Types§
Required Methods§
Object Safety§
This trait is not object safe.