pub trait Serialize: Debug + Sized {
// Required methods
fn write_bytes(&self, dest: &mut impl Write) -> Result<()>;
fn from_bytes(raw: &[u8]) -> Result<Self, Error>;
// Provided method
fn as_bytes(&self) -> Vec<u8> ⓘ { ... }
}Required Methods§
Sourcefn write_bytes(&self, dest: &mut impl Write) -> Result<()>
fn write_bytes(&self, dest: &mut impl Write) -> Result<()>
Writes the key to the given writer.
Sourcefn from_bytes(raw: &[u8]) -> Result<Self, Error>
fn from_bytes(raw: &[u8]) -> Result<Self, Error>
Recreate the key from bytes in the same form as write_bytes produced.
Provided Methods§
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.