Trait epserde::ser::SerializeInner

source ·
pub trait SerializeInner {
    const IS_ZERO_COPY: bool;
    const ZERO_COPY_MISMATCH: bool;

    // Required method
    fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>;
}
Expand description

Inner trait to implement serialization of a type. This trait exists to separate the user-facing Serialize trait from the low-level serialization mechanism of SerializeInner::_serialize_inner. Moreover, it makes it possible to behave slighly differently at the top of the recursion tree (e.g., to write the endianness marker), and to prevent the user from modifying the methods in Serialize.

The user should not implement this trait directly, but rather derive it.

Required Associated Constants§

source

const IS_ZERO_COPY: bool

Inner constant used by the derive macros to keep track recursively of whether the type satisfies the conditions for being zero-copy. It is checked at runtime against the trait implemented by the type, and if a ZeroCopy type has this constant set to false serialization will panic.

source

const ZERO_COPY_MISMATCH: bool

Inner constant used by the derive macros to keep track of whether all fields of a type are zero-copy but neither the attribute #[zero_copy] nor the attribute #[deep_copy] was specified. It is checked at runtime, and if it is true a warning will be issued, as the type could be zero-copy, which would be more efficient.

Required Methods§

source

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

Serialize this structure using the given backend.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SerializeInner for bool

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for char

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for f32

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for f64

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for i8

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for i16

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for i32

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for i64

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for i128

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for isize

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for u8

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for u16

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for u32

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for u64

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for u128

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for ()

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, _backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for usize

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for Box<str>

source§

const IS_ZERO_COPY: bool = false

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for String

source§

const IS_ZERO_COPY: bool = false

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroI8

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroI16

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroI32

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroI64

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroI128

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroIsize

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroU8

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroU16

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroU32

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroU64

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroU128

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl SerializeInner for NonZeroUsize

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T0: ZeroCopy + TypeHash + ReprHash, T1: ZeroCopy + TypeHash + ReprHash, T2: ZeroCopy + TypeHash + ReprHash, T3: ZeroCopy + TypeHash + ReprHash, T4: ZeroCopy + TypeHash + ReprHash, T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T1: ZeroCopy + TypeHash + ReprHash, T2: ZeroCopy + TypeHash + ReprHash, T3: ZeroCopy + TypeHash + ReprHash, T4: ZeroCopy + TypeHash + ReprHash, T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T2: ZeroCopy + TypeHash + ReprHash, T3: ZeroCopy + TypeHash + ReprHash, T4: ZeroCopy + TypeHash + ReprHash, T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T3: ZeroCopy + TypeHash + ReprHash, T4: ZeroCopy + TypeHash + ReprHash, T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T3, T4, T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T4: ZeroCopy + TypeHash + ReprHash, T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T4, T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T5: ZeroCopy + TypeHash + ReprHash, T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T5, T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T6: ZeroCopy + TypeHash + ReprHash, T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T6, T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T7: ZeroCopy + TypeHash + ReprHash, T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T7, T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T8: ZeroCopy + TypeHash + ReprHash, T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T8, T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T9: ZeroCopy + TypeHash + ReprHash, T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T9, T10)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T10: ZeroCopy + TypeHash + ReprHash> SerializeInner for (T10,)

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T: CopyType + TypeHash + ReprHash + SerializeInner> SerializeInner for Box<[T]>
where Box<[T]>: SerializeHelper<<T as CopyType>::Copy>,

source§

const IS_ZERO_COPY: bool = false

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T: CopyType + SerializeInner + TypeHash> SerializeInner for Vec<T>
where Vec<T>: SerializeHelper<<T as CopyType>::Copy>,

source§

const IS_ZERO_COPY: bool = false

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T: CopyType + SerializeInner + TypeHash, const N: usize> SerializeInner for [T; N]

source§

const IS_ZERO_COPY: bool = T::IS_ZERO_COPY

source§

const ZERO_COPY_MISMATCH: bool = T::ZERO_COPY_MISMATCH

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T: SerializeInner> SerializeInner for Option<T>

source§

const IS_ZERO_COPY: bool = false

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

source§

impl<T: ?Sized + TypeHash> SerializeInner for PhantomData<T>

source§

const IS_ZERO_COPY: bool = true

source§

const ZERO_COPY_MISMATCH: bool = false

source§

fn _serialize_inner(&self, _backend: &mut impl WriteWithNames) -> Result<()>

Implementors§