pub trait Encodable {
// Required method
fn encode(&self, bf: &mut Bufferfish) -> Result<(), BufferfishError>;
// Provided method
fn to_bufferfish(&self) -> Result<Bufferfish, BufferfishError> { ... }
}Expand description
Types implementing this trait are able to be encoded to a Bufferfish.
Required Methods§
Sourcefn encode(&self, bf: &mut Bufferfish) -> Result<(), BufferfishError>
fn encode(&self, bf: &mut Bufferfish) -> Result<(), BufferfishError>
Encode the type into a given Bufferfish.
Provided Methods§
Sourcefn to_bufferfish(&self) -> Result<Bufferfish, BufferfishError>
fn to_bufferfish(&self) -> Result<Bufferfish, BufferfishError>
Encode the type into a new Bufferfish.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".