Trait EncodeOptionRef

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

Encodes an optional reference.

§Safety

encode_option_ref must initialize all non-padding bytes of out.

Required Methods§

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

Encodes this optional reference 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> EncodeOptionRef<E> for bool
where E: Encoder + ?Sized,

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<E, T> EncodeOptionRef<E> for Vec<T>
where E: Encoder + ?Sized, T: EncodeRef<E>,

§

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

Implementors§

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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