Trait polars_arrow::array::DictionaryKey

source ·
pub unsafe trait DictionaryKey: NativeType + TryInto<usize> + TryFrom<usize> + Hash {
    const KEY_TYPE: IntegerType;

    // Provided methods
    unsafe fn as_usize(self) -> usize { ... }
    fn always_fits_usize() -> bool { ... }
}
Expand description

Trait denoting NativeTypes that can be used as keys of a dictionary.

§Safety

Any implementation of this trait must ensure that always_fits_usize only returns true if all values succeeds on value::try_into::<usize>().unwrap().

Required Associated Constants§

source

const KEY_TYPE: IntegerType

The corresponding IntegerType of this key

Provided Methods§

source

unsafe fn as_usize(self) -> usize

Represents this key as a usize.

§Safety

The caller must have checked that the value can be casted to usize.

source

fn always_fits_usize() -> bool

If the key type always can be converted to usize.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DictionaryKey for i8

source§

const KEY_TYPE: IntegerType = IntegerType::Int8

source§

impl DictionaryKey for i16

source§

const KEY_TYPE: IntegerType = IntegerType::Int16

source§

impl DictionaryKey for i32

source§

const KEY_TYPE: IntegerType = IntegerType::Int32

source§

impl DictionaryKey for i64

source§

const KEY_TYPE: IntegerType = IntegerType::Int64

source§

impl DictionaryKey for u8

source§

const KEY_TYPE: IntegerType = IntegerType::UInt8

source§

fn always_fits_usize() -> bool

source§

impl DictionaryKey for u16

source§

const KEY_TYPE: IntegerType = IntegerType::UInt16

source§

fn always_fits_usize() -> bool

source§

impl DictionaryKey for u32

source§

const KEY_TYPE: IntegerType = IntegerType::UInt32

source§

fn always_fits_usize() -> bool

source§

impl DictionaryKey for u64

source§

const KEY_TYPE: IntegerType = IntegerType::UInt64

source§

fn always_fits_usize() -> bool

Implementors§