pub trait Binarywhere
Self: Sized,{
// Required methods
fn from_bytes(bytes: &[u8]) -> Option<Self>;
fn as_bytes(&self) -> Vec<u8> ⓘ;
}
Expand description
Trait for binary conversion.
Self::as_bytes
is used to create a binary representation of this instance.- The
Self::from_bytes
method is used to convert the binary data back to its instance.
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Option<Self>
fn from_bytes(bytes: &[u8]) -> Option<Self>
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.