polars_arrow::array

Trait DictionaryKey

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

    // Provided methods
    unsafe fn as_usize(self) -> usize { ... }
    unsafe fn from_usize_unchecked(x: usize) -> Self { ... }
    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

Source

const MAX_USIZE_VALUE: usize

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

unsafe fn from_usize_unchecked(x: usize) -> Self

Create a key from a usize without checking bounds.

§Safety

The caller must have checked that the value can be created from a usize.

Source

fn always_fits_usize() -> bool

If the key type always can be converted 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 DictionaryKey for i8

Source§

const KEY_TYPE: IntegerType = IntegerType::Int8

Source§

const MAX_USIZE_VALUE: usize = 127usize

Source§

impl DictionaryKey for i16

Source§

const KEY_TYPE: IntegerType = IntegerType::Int16

Source§

const MAX_USIZE_VALUE: usize = 32_767usize

Source§

impl DictionaryKey for i32

Source§

const KEY_TYPE: IntegerType = IntegerType::Int32

Source§

const MAX_USIZE_VALUE: usize = 2_147_483_647usize

Source§

impl DictionaryKey for i64

Source§

const KEY_TYPE: IntegerType = IntegerType::Int64

Source§

const MAX_USIZE_VALUE: usize = 9_223_372_036_854_775_807usize

Source§

impl DictionaryKey for u8

Source§

const KEY_TYPE: IntegerType = IntegerType::UInt8

Source§

const MAX_USIZE_VALUE: usize = 255usize

Source§

fn always_fits_usize() -> bool

Source§

impl DictionaryKey for u16

Source§

const KEY_TYPE: IntegerType = IntegerType::UInt16

Source§

const MAX_USIZE_VALUE: usize = 65_535usize

Source§

fn always_fits_usize() -> bool

Source§

impl DictionaryKey for u32

Source§

const KEY_TYPE: IntegerType = IntegerType::UInt32

Source§

const MAX_USIZE_VALUE: usize = 4_294_967_295usize

Source§

fn always_fits_usize() -> bool

Source§

impl DictionaryKey for u64

Source§

const KEY_TYPE: IntegerType = IntegerType::UInt64

Source§

const MAX_USIZE_VALUE: usize = 18_446_744_073_709_551_615usize

Source§

fn always_fits_usize() -> bool

Implementors§