pub trait FrameCodec {
type Record;
// Required methods
fn encode(record: &Self::Record) -> Vec<u8> ⓘ;
fn decode(payload: &[u8]) -> Result<Self::Record>;
}Expand description
Serialization seam: how one record becomes a frame payload and back.
encode is infallible because the codecs we use (protobuf, JSON over plain
owned types) cannot fail in practice; a codec with fallible encoding should
surface that as an io::Error from a panic-documented invariant instead.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".