Trait Codec

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

Required Methods§

Source

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

Source

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

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) -> u8

Source§

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

Source§

impl Codec for u16

Source§

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

Source§

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

Source§

impl Codec for u32

Source§

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

Source§

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

Source§

impl Codec for u64

Source§

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

Source§

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

Source§

impl Codec for Ipv4Addr

Source§

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

Source§

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

Source§

impl Codec for Ipv6Addr

Source§

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

Source§

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

Implementors§