Skip to main content

ZeroCopyBuilder

Trait ZeroCopyBuilder 

Source
pub trait ZeroCopyBuilder<E: Endian = NativeEndian, const ALIGN: usize = 0> {
    type Target: ZeroCopy;

    // Required method
    fn build_to_target(
        self,
        builder: &mut ZeroBuilder,
        offset: usize,
    ) -> Self::Target;

    // Provided method
    fn build(self, builder: &mut ZeroBuilder) -> usize
       where Self: Sized { ... }
}
Available on crate feature zero-copy only.
Expand description

A trait for types that can be built into a zero-copy structure.

Required Associated Types§

Source

type Target: ZeroCopy

The target type that this builds into.

Required Methods§

Source

fn build_to_target( self, builder: &mut ZeroBuilder, offset: usize, ) -> Self::Target

Available on crate feature alloc only.

Build the zero-copy type into the builder.

Provided Methods§

Source

fn build(self, builder: &mut ZeroBuilder) -> usize
where Self: Sized,

Available on crate feature alloc only.

Build the zero-copy type into the builder and return its offset.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<E: Endian, T, B, const ALIGN: usize> ZeroCopyBuilder<E, ALIGN> for Vec<B>
where B: ZeroCopyBuilder<E, 0, Target = T>, T: ZeroCopy,

Available on crate feature alloc only.
Source§

type Target = ZeroSlice<T, ALIGN, E>

The target type that this builds into.

Source§

fn build_to_target( self, builder: &mut ZeroBuilder, offset: usize, ) -> Self::Target

Builds the object into the target location.

Source§

impl<E: Endian, T, B, const N: usize> ZeroCopyBuilder<E> for [B; N]
where B: ZeroCopyBuilder<E, 0, Target = T>, T: ZeroCopy,

Source§

type Target = [T; N]

The target type that this builds into.

Source§

fn build_to_target( self, builder: &mut ZeroBuilder, offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for String

Available on crate feature alloc only.
Source§

type Target = ZeroStr<E>

The target type that this builds into.

Source§

fn build_to_target( self, builder: &mut ZeroBuilder, offset: usize, ) -> Self::Target

Builds the object into the target location.

Source§

impl<E: Endian> ZeroCopyBuilder<E> for bool

Source§

type Target = bool

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for char

Source§

type Target = char

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for f32

Source§

type Target = f32

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for f64

Source§

type Target = f64

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for i8

Source§

type Target = i8

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for i16

Source§

type Target = i16

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for i32

Source§

type Target = i32

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for i64

Source§

type Target = i64

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for i128

Source§

type Target = i128

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for u8

Source§

type Target = u8

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for u16

Source§

type Target = u16

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for u32

Source§

type Target = u32

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for u64

Source§

type Target = u64

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.
Source§

impl<E: Endian> ZeroCopyBuilder<E> for u128

Source§

type Target = u128

The target type that this builds into.

Source§

fn build_to_target( self, _builder: &mut ZeroBuilder, _offset: usize, ) -> Self::Target

Available on crate feature alloc only.

Implementors§