Skip to main content

Codec

Trait Codec 

pub trait Codec: Sized {
    // Required methods
    fn decode<B>(buf: &mut B) -> Result<Self, UnexpectedEnd>
       where B: Buf;
    fn encode<B>(&self, buf: &mut B)
       where B: BufMut;
}
Available on crate feature quic only.
Expand description

Infallible encoding and decoding of QUIC primitives

Required Methods§

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

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

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

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".

Implementations on Foreign Types§

§

impl Codec for u8

§

fn decode<B>(buf: &mut B) -> Result<u8, UnexpectedEnd>
where B: Buf,

§

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

§

impl Codec for u16

§

fn decode<B>(buf: &mut B) -> Result<u16, UnexpectedEnd>
where B: Buf,

§

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

§

impl Codec for u32

§

fn decode<B>(buf: &mut B) -> Result<u32, UnexpectedEnd>
where B: Buf,

§

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

§

impl Codec for u64

§

fn decode<B>(buf: &mut B) -> Result<u64, UnexpectedEnd>
where B: Buf,

§

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

Implementors§

§

impl Codec for Code

§

impl Codec for FrameType

§

impl Codec for Ipv4Addr

§

impl Codec for Ipv6Addr

§

impl Codec for StreamId

§

impl Codec for VarInt

§

impl Codec for Version

§

impl Codec for WireVersion