Trait HandleCore

Source
pub trait HandleCore:
    Clone
    + Copy
    + Eq
    + PartialEq
    + Hash
    + Debug
    + Ord
    + PartialOrd {
    // Required methods
    fn into_index(self) -> usize;
    fn from_index(index: usize) -> Self;
}
Expand description

A type that may serve as the internal representation of a Handle.

A Handle is defined by a single field known as its core. The core identifies the handled object, and is an instance of a lightweight type that implements HandleCore. It should be convertible from and to a usize, which represents the handled object’s serial-number.

Required Methods§

Source

fn into_index(self) -> usize

Get the serial number represented by this HandleCore.

Source

fn from_index(index: usize) -> Self

Transform a serial number into an identifying HandleCore.

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 HandleCore for u8

Source§

fn into_index(self) -> usize

Source§

fn from_index(index: usize) -> Self

Source§

impl HandleCore for u16

Source§

fn into_index(self) -> usize

Source§

fn from_index(index: usize) -> Self

Implementors§