Trait Encode

Source
pub trait Encode {
    type Error: From<Error> + Error + Send + Sync + 'static;

    // Required methods
    fn encode<W>(
        &self,
        writer: &mut W,
    ) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend
       where W: Write;
    fn size(&self) -> usize;
}

Required Associated Types§

Source

type Error: From<Error> + Error + Send + Sync + 'static

Required Methods§

Source

fn encode<W>( &self, writer: &mut W, ) -> impl Future<Output = Result<(), Self::Error>> + MaybeSend
where W: Write,

Source

fn size(&self) -> usize

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 Encode for &str

Source§

type Error = Error

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Source§

impl Encode for &[u8]

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for bool

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for i8

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for i16

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for i32

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for i64

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for u8

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for u16

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for u32

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for u64

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl Encode for String

Source§

type Error = Error

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Source§

impl Encode for Bytes

Source§

type Error = Error

Source§

async fn encode<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>

Source§

fn size(&self) -> usize

Source§

impl<T> Encode for Arc<T>
where T: Encode + Send + Sync,

Source§

type Error = <T as Encode>::Error

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Source§

impl<T> Encode for Vec<T>
where T: Encode + Send + Sync, Error: From<<T as Encode>::Error>,

Source§

type Error = Error

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Source§

impl<T: Encode + Sync> Encode for &T

Source§

type Error = <T as Encode>::Error

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Source§

impl<V> Encode for Option<V>
where V: Encode + Sync,

Source§

type Error = EncodeError<<V as Encode>::Error>

Source§

async fn encode<W>(&self, writer: &mut W) -> Result<(), Self::Error>
where W: Write,

Source§

fn size(&self) -> usize

Implementors§