pub trait UnsignedPackable: Sized {
type Base: Copy;
const BITS: usize;
// Required methods
fn from_unsigned(value: Self::Base) -> Self;
fn to_unsigned(&self) -> Self::Base;
}Expand description
A trait for any object that can be packed into and unpacked from an unsigned.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn from_unsigned(value: Self::Base) -> Self
fn from_unsigned(value: Self::Base) -> Self
Convert the base unsigned value into an instance of Self. Only the least significant
Self::BITS bits have meaning, all other bits are guaranteed to be zero. This function
must succeed for any given value.
Sourcefn to_unsigned(&self) -> Self::Base
fn to_unsigned(&self) -> Self::Base
Convert this object into the base unsigned type. Only the least significant
Self::BITS bits need to be well defined.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".