Trait Encode

Source
pub trait Encode {
    // Required methods
    fn encode(&self, dst: &mut WriteCursor<'_>) -> EncodeResult<()>;
    fn name(&self) -> &'static str;
    fn size(&self) -> usize;
}
Expand description

PDU that can be encoded into its binary form.

The resulting binary payload is a fully encoded PDU that may be sent to the peer.

This trait is object-safe and may be used in a dynamic context.

Required Methods§

Source

fn encode(&self, dst: &mut WriteCursor<'_>) -> EncodeResult<()>

Encodes this PDU in-place using the provided WriteCursor.

Source

fn name(&self) -> &'static str

Returns the associated PDU name associated.

Source

fn size(&self) -> usize

Computes the size in bytes for this PDU.

Implementors§