Skip to main content

DataType

Trait DataType 

Source
pub trait DataType {
    const MODE: DataMode;
    const LENGTH: usize = 0;

    // Provided methods
    fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian) { ... }
    fn push_var1_data(
        &self,
        var_length: &mut Vec<u32>,
        data: &mut Vec<u8>,
        endian: &Endian,
    ) { ... }
}
Expand description

Defines how a type contributes fixed or variable data to an encoder.

Required Associated Constants§

Source

const MODE: DataMode

Encoding mode for this type.

Provided Associated Constants§

Source

const LENGTH: usize = 0

Fixed byte length, used only for Fixed types.

Provided Methods§

Source

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Push fixed-width bytes into the fixed region.

Source

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Push variable-length bytes into the data region and record length.

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 DataType for i8

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for i16

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for i32

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for i64

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for i128

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for isize

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for u8

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for u16

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for u32

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for u64

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for u128

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl DataType for usize

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl<T0, T1> DataType for (T0, T1)
where T0: DataType, T1: DataType,

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T> DataType for &[T]
where T: DataType,

Source§

const MODE: DataMode = DataMode::Var1

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T> DataType for &Vec<T>
where T: DataType,

Source§

const MODE: DataMode = DataMode::Var1

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T> DataType for &mut [T]
where T: DataType,

Source§

const MODE: DataMode = DataMode::Var1

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T> DataType for &mut Vec<T>
where T: DataType,

Source§

const MODE: DataMode = DataMode::Var1

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T> DataType for Vec<T>
where T: DataType,

Source§

const MODE: DataMode = DataMode::Var1

Source§

fn push_var1_data( &self, var_length: &mut Vec<u32>, data: &mut Vec<u8>, endian: &Endian, )

Source§

impl<T, const N: usize> DataType for &[T; N]
where T: DataType,

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl<T, const N: usize> DataType for &mut [T; N]
where T: DataType,

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Source§

impl<T, const N: usize> DataType for [T; N]
where T: DataType,

Source§

const MODE: DataMode = DataMode::Fixed

Source§

const LENGTH: usize

Source§

fn push_fixed_data(&self, encoder_fixed: &mut Vec<u8>, endian: &Endian)

Implementors§