polars_arrow::types

Trait AlignedBytes

Source
pub trait AlignedBytes:
    Pod
    + Zeroable
    + Copy
    + Default
    + Eq {
    type Unaligned: AsRef<[u8]> + AsMut<[u8]> + Index<usize, Output = u8> + IndexMut<usize, Output = u8> + for<'a> TryFrom<&'a [u8]> + Debug + Default + IntoIterator<Item = u8> + Pod;

    const ALIGNMENT: usize;
    const SIZE: usize;

    // Required methods
    fn to_unaligned(&self) -> Self::Unaligned;
    fn from_unaligned(unaligned: Self::Unaligned) -> Self;

    // Provided method
    fn cast_vec_ref_mut<T: AlignedBytesCast<Self>>(
        vec: &mut Vec<T>,
    ) -> &mut Vec<Self> { ... }
}
Expand description

A representation of a type as raw bytes with the same alignment as the original type.

Required Associated Constants§

Required Associated Types§

Source

type Unaligned: AsRef<[u8]> + AsMut<[u8]> + Index<usize, Output = u8> + IndexMut<usize, Output = u8> + for<'a> TryFrom<&'a [u8]> + Debug + Default + IntoIterator<Item = u8> + Pod

Required Methods§

Source

fn to_unaligned(&self) -> Self::Unaligned

Source

fn from_unaligned(unaligned: Self::Unaligned) -> Self

Provided Methods§

Source

fn cast_vec_ref_mut<T: AlignedBytesCast<Self>>( vec: &mut Vec<T>, ) -> &mut Vec<Self>

Safely cast a mutable reference to a Vec of T to a mutable reference of Self.

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.

Implementors§

Source§

impl AlignedBytes for Bytes1Alignment1

Source§

const ALIGNMENT: usize = 1usize

Source§

const SIZE: usize = 1usize

Source§

type Unaligned = [u8; 1]

Source§

impl AlignedBytes for Bytes2Alignment2

Source§

const ALIGNMENT: usize = 2usize

Source§

const SIZE: usize = 2usize

Source§

type Unaligned = [u8; 2]

Source§

impl AlignedBytes for Bytes4Alignment4

Source§

const ALIGNMENT: usize = 4usize

Source§

const SIZE: usize = 4usize

Source§

type Unaligned = [u8; 4]

Source§

impl AlignedBytes for Bytes8Alignment4

Source§

const ALIGNMENT: usize = 4usize

Source§

const SIZE: usize = 8usize

Source§

type Unaligned = [u8; 8]

Source§

impl AlignedBytes for Bytes8Alignment8

Source§

const ALIGNMENT: usize = 8usize

Source§

const SIZE: usize = 8usize

Source§

type Unaligned = [u8; 8]

Source§

impl AlignedBytes for Bytes12Alignment4

Source§

const ALIGNMENT: usize = 4usize

Source§

const SIZE: usize = 12usize

Source§

type Unaligned = [u8; 12]

Source§

impl AlignedBytes for Bytes16Alignment4

Source§

const ALIGNMENT: usize = 4usize

Source§

const SIZE: usize = 16usize

Source§

type Unaligned = [u8; 16]

Source§

impl AlignedBytes for Bytes16Alignment8

Source§

const ALIGNMENT: usize = 8usize

Source§

const SIZE: usize = 16usize

Source§

type Unaligned = [u8; 16]

Source§

impl AlignedBytes for Bytes16Alignment16

Source§

const ALIGNMENT: usize = 16usize

Source§

const SIZE: usize = 16usize

Source§

type Unaligned = [u8; 16]

Source§

impl AlignedBytes for Bytes32Alignment16

Source§

const ALIGNMENT: usize = 16usize

Source§

const SIZE: usize = 32usize

Source§

type Unaligned = [u8; 32]