polars_arrow::types

Trait NativeType

Source
pub trait NativeType:
    Sealed
    + Pod
    + Send
    + Sync
    + Sized
    + RefUnwindSafe
    + Debug
    + Display
    + PartialEq
    + Default
    + Copy
    + TotalOrd
    + IsNull
    + MinMax
    + AlignedBytesCast<Self::AlignedBytes> {
    type Bytes: AsRef<[u8]> + AsMut<[u8]> + Index<usize, Output = u8> + IndexMut<usize, Output = u8> + for<'a> TryFrom<&'a [u8]> + Debug + Default + IntoIterator<Item = u8>;
    type AlignedBytes: AlignedBytes<Unaligned = Self::Bytes> + From<Self> + Into<Self>;

    const PRIMITIVE: PrimitiveType;

    // Required methods
    fn to_le_bytes(&self) -> Self::Bytes;
    fn to_be_bytes(&self) -> Self::Bytes;
    fn from_le_bytes(bytes: Self::Bytes) -> Self;
    fn from_be_bytes(bytes: Self::Bytes) -> Self;
}
Expand description

Sealed trait implemented by all physical types that can be allocated, serialized and deserialized by this crate. All O(N) allocations in this crate are done for this trait alone.

Required Associated Constants§

Source

const PRIMITIVE: PrimitiveType

The corresponding variant of PrimitiveType.

Required Associated Types§

Source

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

Type denoting its representation as bytes. This is [u8; N] where N = size_of::<T>.

Source

type AlignedBytes: AlignedBytes<Unaligned = Self::Bytes> + From<Self> + Into<Self>

Type denoting its representation as aligned bytes.

This is [u8; N] where N = size_of::<Self> and has alignment align_of::<Self>.

Required Methods§

Source

fn to_le_bytes(&self) -> Self::Bytes

To bytes in little endian

Source

fn to_be_bytes(&self) -> Self::Bytes

To bytes in big endian

Source

fn from_le_bytes(bytes: Self::Bytes) -> Self

From bytes in little endian

Source

fn from_be_bytes(bytes: Self::Bytes) -> Self

From bytes in big endian

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 NativeType for f32

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Float32

Source§

type Bytes = [u8; 4]

Source§

type AlignedBytes = Bytes4Alignment4

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for f64

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Float64

Source§

type Bytes = [u8; 8]

Source§

type AlignedBytes = Bytes8Alignment8

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for i8

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Int8

Source§

type Bytes = [u8; 1]

Source§

type AlignedBytes = Bytes1Alignment1

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for i16

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Int16

Source§

type Bytes = [u8; 2]

Source§

type AlignedBytes = Bytes2Alignment2

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for i32

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Int32

Source§

type Bytes = [u8; 4]

Source§

type AlignedBytes = Bytes4Alignment4

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for i64

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Int64

Source§

type Bytes = [u8; 8]

Source§

type AlignedBytes = Bytes8Alignment8

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for i128

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::Int128

Source§

type Bytes = [u8; 16]

Source§

type AlignedBytes = Bytes16Alignment16

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for u8

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::UInt8

Source§

type Bytes = [u8; 1]

Source§

type AlignedBytes = Bytes1Alignment1

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for u16

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::UInt16

Source§

type Bytes = [u8; 2]

Source§

type AlignedBytes = Bytes2Alignment2

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for u32

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::UInt32

Source§

type Bytes = [u8; 4]

Source§

type AlignedBytes = Bytes4Alignment4

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for u64

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::UInt64

Source§

type Bytes = [u8; 8]

Source§

type AlignedBytes = Bytes8Alignment8

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Source§

impl NativeType for u128

Source§

const PRIMITIVE: PrimitiveType = PrimitiveType::UInt128

Source§

type Bytes = [u8; 16]

Source§

type AlignedBytes = Bytes16Alignment16

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn to_be_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

fn from_be_bytes(bytes: Self::Bytes) -> Self

Implementors§