Trait EncodeOption

pub unsafe trait EncodeOption<E>: Sized + EncodableOption
where E: ?Sized,
{ // Required method fn encode_option( this: Option<Self>, encoder: &mut E, out: &mut MaybeUninit<Self::EncodedOption>, ) -> Result<(), EncodeError>; }
Expand description

Encodes an optional value.

§Safety

encode_option must initialize all non-padding bytes of out.

Required Methods§

fn encode_option( this: Option<Self>, encoder: &mut E, out: &mut MaybeUninit<Self::EncodedOption>, ) -> Result<(), EncodeError>

Encodes this optional value into an encoder and output.

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§

§

impl<E> EncodeOption<E> for &str
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for bool
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for f32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for f64
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for i8
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for i16
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for i32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for i64
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for u8
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for u16
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for u32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for u64
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for ()
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for String
where E: Encoder + ?Sized,

§

impl<E, T> EncodeOption<E> for &[T]
where E: Encoder + ?Sized, T: EncodeRef<E>,

§

impl<E, T> EncodeOption<E> for &T
where T: EncodeOptionRef<E>, E: ?Sized,

§

impl<E, T> EncodeOption<E> for Box<T>
where T: EncodeOption<E>, E: ?Sized,

§

fn encode_option( this: Option<Box<T>>, encoder: &mut E, out: &mut MaybeUninit<<Box<T> as EncodableOption>::EncodedOption>, ) -> Result<(), EncodeError>

§

impl<E, T> EncodeOption<E> for Vec<T>
where E: Encoder + ?Sized, T: Encode<E>,

§

fn encode_option( this: Option<Vec<T>>, encoder: &mut E, out: &mut MaybeUninit<<Vec<T> as EncodableOption>::EncodedOption>, ) -> Result<(), EncodeError>

Implementors§

§

impl<E> EncodeOption<E> for Channel
where E: HandleEncoder + ?Sized,

§

impl<E> EncodeOption<E> for Handle
where E: HandleEncoder + ?Sized,

§

impl<E> EncodeOption<E> for WireF32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireF64
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireI16
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireI32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireI64
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireU16
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireU32
where E: Encoder + ?Sized,

§

impl<E> EncodeOption<E> for WireU64
where E: Encoder + ?Sized,

§

impl<E, T, P> EncodeOption<E> for ClientEnd<T, P>
where T: EncodeOption<E>, P: 'static, E: ?Sized,

§

impl<E, T, P> EncodeOption<E> for ServerEnd<T, P>
where T: EncodeOption<E>, P: 'static, E: ?Sized,