Skip to main content

ArrayElement

Trait ArrayElement 

Source
pub trait ArrayElement:
    Clone
    + Send
    + Sync
    + 'static {
    const DTYPE: DType;

    // Required methods
    fn encode_chunk(values: &[Self]) -> Vec<u8> ;
    fn decode_chunk(bytes: &[u8]) -> Vec<Self>;
    fn fill_element(fill: Option<&FillValue>) -> Self;
}
Expand description

Unified element type for all array operations.

Implemented by all fixed-width numeric primitives and variable-length types (String, Vec<u8>). The trait provides chunk-level encode/decode and fill-value generation so that a single generic code path handles both.

Required Associated Constants§

Source

const DTYPE: DType

The DType this Rust type maps to on disk.

Required Methods§

Source

fn encode_chunk(values: &[Self]) -> Vec<u8>

Encodes a chunk’s worth of values into the on-disk byte representation.

Source

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Decodes bytes produced by encode_chunk back into values.

Source

fn fill_element(fill: Option<&FillValue>) -> Self

Returns the element used for unwritten positions, derived from the array’s fill value (or this type’s natural default when fill is None or not applicable).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ArrayElement for String

Source§

const DTYPE: DType = DType::String

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(_fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for Vec<u8>

Source§

const DTYPE: DType = DType::Binary

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(_fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for f32

Source§

const DTYPE: DType = DType::Float32

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for f64

Source§

const DTYPE: DType = DType::Float64

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for i8

Source§

const DTYPE: DType = DType::Int8

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for i16

Source§

const DTYPE: DType = DType::Int16

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for i32

Source§

const DTYPE: DType = DType::Int32

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for i64

Source§

const DTYPE: DType = DType::Int64

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for u8

Source§

const DTYPE: DType = DType::UInt8

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for u16

Source§

const DTYPE: DType = DType::UInt16

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for u32

Source§

const DTYPE: DType = DType::UInt32

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Source§

impl ArrayElement for u64

Source§

const DTYPE: DType = DType::UInt64

Source§

fn encode_chunk(values: &[Self]) -> Vec<u8>

Source§

fn decode_chunk(bytes: &[u8]) -> Vec<Self>

Source§

fn fill_element(fill: Option<&FillValue>) -> Self

Implementors§

Source§

impl ArrayElement for TimestampNs

Source§

const DTYPE: DType = DType::TimestampNs