pub trait Conversion<T>where
Self: Sized,{
type Error;
// Required methods
fn from_bits(bits: T) -> Self;
fn from_hex(hex_str: &str) -> Self;
fn try_from_bits(bits: T) -> Result<Self, Self::Error>;
fn try_from_hex(hex_str: &str) -> Result<Self, Self::Error>;
fn into_bits(self) -> T;
fn into_hex(self) -> String;
}
Expand description
A trait for types that can be converted to and from bitfield representations (bits
)
of integers and hexadecimal string slices (hex).
§alloc
features:
into_hex
Required Associated Types§
Required Methods§
Sourcefn try_from_bits(bits: T) -> Result<Self, Self::Error>
fn try_from_bits(bits: T) -> Result<Self, Self::Error>
Sourcefn try_from_hex(hex_str: &str) -> Result<Self, Self::Error>
fn try_from_hex(hex_str: &str) -> Result<Self, Self::Error>
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.