Trait BTreeKey

Source
pub trait BTreeKey: Copy {
    type Int: BTreeInteger;

    // Required methods
    fn to_int(self) -> Self::Int;
    fn from_int(int: Self::Int) -> Self;
}
Expand description

Trait which must be implemented for all keys inserted into a BTree.

BTree requires that keys be integers and reserves the maximum integer value for internal use. This trait is already implementated for all integers from the nonmax crate, but this crate allows for custom key types that are convertible to/from an integer.

Note that keys in the BTree are ordered by their integer value and not the Ord implementation of the key type.

Required Associated Types§

Required Methods§

Source

fn to_int(self) -> Self::Int

Converts the key to an integer.

Source

fn from_int(int: Self::Int) -> Self

Recovers the key from an integer.

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 BTreeKey for NonMaxI8

Source§

type Int = NonMaxI8

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxI16

Source§

type Int = NonMaxI16

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxI32

Source§

type Int = NonMaxI32

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxI64

Source§

type Int = NonMaxI64

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxI128

Source§

type Int = NonMaxI128

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxU8

Source§

type Int = NonMaxU8

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxU16

Source§

type Int = NonMaxU16

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxU32

Source§

type Int = NonMaxU32

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxU64

Source§

type Int = NonMaxU64

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Source§

impl BTreeKey for NonMaxU128

Source§

type Int = NonMaxU128

Source§

fn to_int(self) -> Self::Int

Source§

fn from_int(int: Self::Int) -> Self

Implementors§