pub trait FrameEncoder {
type Frame;
// Required method
fn encode(&self, frame: &Self::Frame) -> Result<Vec<u8>, Error>;
}Expand description
Encodes a frame back to wire bytes: the inverse of FrameParser::parse.
Used for round-trip tests (encode, then parse, and compare) and for clients that send requests. An encoder must produce bytes that its parser accepts.
§Example
ⓘ
let bytes = encoder.encode(&frame)?;
assert_eq!(parser.parse(&bytes)?, frame);Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".