pub trait ProtocolWire: Sized {
const PROTOCOL_ID: &'static str;
// Required methods
fn encode_to_vec(&self) -> Vec<u8> ⓘ;
fn decode_from_bytes(bytes: &[u8]) -> Result<Self>;
}Expand description
Encode/decode the typed payload inside ProtocolAttachment.
Required Associated Constants§
Sourceconst PROTOCOL_ID: &'static str
const PROTOCOL_ID: &'static str
Protocol slug this wire type belongs to.
Required Methods§
Sourcefn encode_to_vec(&self) -> Vec<u8> ⓘ
fn encode_to_vec(&self) -> Vec<u8> ⓘ
Serialize this payload to bytes for attachment storage.
Sourcefn decode_from_bytes(bytes: &[u8]) -> Result<Self>
fn decode_from_bytes(bytes: &[u8]) -> Result<Self>
Deserialize bytes produced by Self::encode_to_vec.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".