pub trait ByteableRaw<Regular>: Byteable {
// Required methods
fn to_regular(self) -> Regular;
fn from_regular(regular: Regular) -> Self;
}Expand description
Trait for types that have a raw byteable representation and can be converted to/from a regular form.
This trait is automatically implemented for types that implement Byteable when there is
a corresponding ByteableRegular type that uses them as their raw representation.
This trait facilitates a pattern where you have a “raw” type (suitable for byte serialization) and a “regular” type (more convenient for application logic), and you need to convert between them.
Required Methods§
Sourcefn to_regular(self) -> Regular
fn to_regular(self) -> Regular
Converts the raw representation to the regular form.
Sourcefn from_regular(regular: Regular) -> Self
fn from_regular(regular: Regular) -> Self
Converts the regular form to the raw representation.
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.