Skip to main content

WireValue

Trait WireValue 

Source
pub trait WireValue:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn wire_type_id() -> WireTypeId
       where Self: Sized;
}
Expand description

A value that can travel on the wire under some WireCodec.

Implementors give every concrete message type a stable WireTypeId. The trait carries no encode/decode methods of its own: per-codec bounds (such as serde::Serialize for JSON/CBOR or prost::Message for protobuf) are enforced at codec registration time.

Required Methods§

Source

fn wire_type_id() -> WireTypeId
where Self: Sized,

Stable identifier for the message type. The id is used by the codec registry to dispatch to the correct decoder when bytes arrive on the wire.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§