Encode

Trait Encode 

Source
pub trait Encode<V>: Sized {
    // Required method
    fn encode<W: BufMut>(&self, w: &mut W, version: V);

    // Provided method
    fn encode_bytes(&self, v: V) -> Bytes { ... }
}
Expand description

Write the value to the buffer using the given version.

Required Methods§

Source

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Encode the value to the given writer.

This will panic if the bytes::BufMut does not have enough capacity.

Provided Methods§

Source

fn encode_bytes(&self, v: V) -> Bytes

Encode the value into a Bytes buffer.

NOTE: This will allocate.

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<T: Encode<V>, V> Encode<V> for Arc<T>

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<T: Encode<V>, V: Clone> Encode<V> for &[T]

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<V> Encode<V> for &str

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<V> Encode<V> for Cow<'_, str>

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<V> Encode<V> for bool

Source§

fn encode<W: BufMut>(&self, w: &mut W, _: V)

Source§

impl<V> Encode<V> for i8

Source§

fn encode<W: BufMut>(&self, w: &mut W, _: V)

Source§

impl<V> Encode<V> for u8

Source§

fn encode<W: BufMut>(&self, w: &mut W, _: V)

Source§

impl<V> Encode<V> for u16

Source§

fn encode<W: BufMut>(&self, w: &mut W, _: V)

Source§

impl<V> Encode<V> for u32

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<V> Encode<V> for u64

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Encode a varint to the given writer.

Source§

impl<V> Encode<V> for usize

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Encode a varint to the given writer.

Source§

impl<V> Encode<V> for String

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Source§

impl<V> Encode<V> for Vec<u8>

Source§

fn encode<W: BufMut>(&self, w: &mut W, version: V)

Implementors§

Source§

impl<T: Message> Encode<Version> for T

Source§

impl<T: Message> Encode<Version> for T

Source§

impl<V> Encode<V> for FilterType

Source§

impl<V> Encode<V> for GroupOrder

Source§

impl<V> Encode<V> for TrackStatusCode

Source§

impl<V> Encode<V> for ControlType

Source§

impl<V> Encode<V> for DataType

Source§

impl<V> Encode<V> for FetchHeader

Source§

impl<V> Encode<V> for RequestId

Source§

impl<V> Encode<V> for Path<'_>

Source§

impl<V> Encode<V> for Bytes

Source§

impl<V> Encode<V> for VarInt

Source§

impl<V> Encode<V> for Version

Source§

impl<V: Clone> Encode<V> for GroupHeader

Source§

impl<V: Clone> Encode<V> for Location

Source§

impl<V: Clone> Encode<V> for moq_lite::ietf::Parameters

Source§

impl<V: Clone> Encode<V> for moq_lite::lite::Parameters

Source§

impl<V: Clone> Encode<V> for Versions

Source§

impl<V: Copy> Encode<V> for FetchType<'_>

Source§

impl<const SCALE: u64, V> Encode<V> for Timescale<SCALE>