Skip to main content

Key

Trait Key 

Source
pub trait Key:
    Copy
    + Send
    + Sync
    + Eq
    + Ord
    + Hash {
    // Required methods
    fn key(self) -> i64;
    fn from_key(key: i64) -> Option<Self>;
    fn range(x: &[Self]) -> (i64, i64);
}
Expand description

An item as a whole number: a Boolean’s 0 or 1, an integer, a character’s code point, or an order key. Two items match exactly when their keys are equal. A 64-bit unsigned key wraps to a negative number, which keeps keys distinct.

Required Methods§

Source

fn key(self) -> i64

Source

fn from_key(key: i64) -> Option<Self>

The item whose key is key, if there is one.

Source

fn range(x: &[Self]) -> (i64, i64)

The least and the greatest key of x, which isn’t empty, in one pass that vectorizes for narrow items.

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 Key for bool

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for char

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for i16

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for i32

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for i64

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for u8

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for u16

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for u32

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Source§

impl Key for u64

Source§

fn key(self) -> i64

Source§

fn from_key(key: i64) -> Option<Self>

Source§

fn range(x: &[Self]) -> (i64, i64)

Implementors§