Skip to main content

Tlv

Trait Tlv 

Source
pub trait Tlv: Sized {
    const TYPE: u8;

    // Required methods
    fn try_from_value(value: &[u8]) -> Option<Self>;
    fn value_bytes(&self) -> Cow<'_, [u8]>;

    // Provided method
    fn try_from_parts(typ: u8, value: &[u8]) -> Option<Self> { ... }
}
Expand description

PROXY protocol v2 type-length-value extension.

Required Associated Constants§

Source

const TYPE: u8

Numeric TLV type identifier.

Required Methods§

Source

fn try_from_value(value: &[u8]) -> Option<Self>

Attempts to decode a TLV value payload.

Source

fn value_bytes(&self) -> Cow<'_, [u8]>

Serializes this TLV’s value payload.

Provided Methods§

Source

fn try_from_parts(typ: u8, value: &[u8]) -> Option<Self>

Attempts to decode a TLV from its type identifier and value payload.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Tlv for Alpn

Source§

const TYPE: u8 = PP2_TYPE_ALPN

Source§

impl Tlv for Authority

Source§

const TYPE: u8 = PP2_TYPE_AUTHORITY

Source§

impl Tlv for Crc32c

Source§

const TYPE: u8 = PP2_TYPE_CRC32C

Source§

impl Tlv for NetNamespace

Source§

const TYPE: u8 = PP2_TYPE_NETNS

Source§

impl Tlv for Noop

Source§

const TYPE: u8 = PP2_TYPE_NOOP

Source§

impl Tlv for Ssl

Source§

const TYPE: u8 = PP2_TYPE_SSL

Source§

impl Tlv for UniqueId

Source§

const TYPE: u8 = PP2_TYPE_UNIQUE_ID