Trait EnvelopeCodec
Source pub trait EnvelopeCodec: Send + Sync {
// Required methods
fn encode(&self, envelope: &Envelope) -> Result<Vec<u8>, EnvelopeError>;
fn decode(&self, data: &[u8]) -> Result<Envelope, EnvelopeError>;
}
Expand description
A codec that serializes and deserializes Envelopes.
Implementations must be Send + Sync so they can be shared across
async tasks behind an Arc.
§Default implementation
JsonCodec — produces compact JSON. Suitable for debugging and
low-to-medium throughput applications.
Encode an envelope into a byte buffer.
Decode an envelope from a byte buffer.