OffsetType

Trait OffsetType 

Source
pub trait OffsetType:
    Copy
    + Default
    + PartialOrd
    + Sub<Output = Self> {
    const SIZE: usize;

    // Required methods
    fn from_usize(value: usize) -> Option<Self>;
    fn to_usize(self) -> usize;
}
Expand description

Trait for offset types used in StringTape.

This trait defines the interface for offset types that can be used to index into the string data buffer. Implementations are provided for i32 and i64 to match Apache Arrow’s String and LargeString array types, and for u32 and u64 when unsigned offsets are desired (note: Arrow interop is i32/i64-only).

Required Associated Constants§

Source

const SIZE: usize

Size of the offset type in bytes.

Required Methods§

Source

fn from_usize(value: usize) -> Option<Self>

Convert a usize value to this offset type.

Returns None if the value is too large to be represented by this offset type.

Source

fn to_usize(self) -> usize

Convert this offset value to usize.

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 OffsetType for i32

Source§

const SIZE: usize = 4usize

Source§

fn from_usize(value: usize) -> Option<Self>

Source§

fn to_usize(self) -> usize

Source§

impl OffsetType for i64

Source§

const SIZE: usize = 8usize

Source§

fn from_usize(value: usize) -> Option<Self>

Source§

fn to_usize(self) -> usize

Source§

impl OffsetType for u32

Source§

const SIZE: usize = 4usize

Source§

fn from_usize(value: usize) -> Option<Self>

Source§

fn to_usize(self) -> usize

Source§

impl OffsetType for u64

Source§

const SIZE: usize = 8usize

Source§

fn from_usize(value: usize) -> Option<Self>

Source§

fn to_usize(self) -> usize

Implementors§