Trait Codec

Source
pub trait Codec: Sized {
    // Required methods
    fn decode<B: Buf>(buf: &mut B) -> Result<Self>;
    fn encode<B: BufMut>(&self, buf: &mut B);
}
Expand description

Infallible encoding and decoding of QUIC primitives

Required Methods§

Source

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Decode a Self from the provided buffer, if the buffer is large enough

Source

fn encode<B: BufMut>(&self, buf: &mut B)

Append the encoding of self to the provided buffer

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Codec for u8

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Source§

impl Codec for u16

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Source§

impl Codec for u32

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Source§

impl Codec for u64

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Source§

impl Codec for Ipv4Addr

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Source§

impl Codec for Ipv6Addr

Source§

fn decode<B: Buf>(buf: &mut B) -> Result<Self>

Source§

fn encode<B: BufMut>(&self, buf: &mut B)

Implementors§