Trait TokenID

Source
pub trait TokenID: PartialEq + Clone {
    // Required methods
    fn zero() -> Self;
    fn coerce(t: u64) -> Self;
    fn restore(self) -> u64;
}
Expand description

A trait to be able to convert token IDs on the fly

Required Methods§

Source

fn zero() -> Self

Get a zero value

Source

fn coerce(t: u64) -> Self

Convert a u64 to Self

Source

fn restore(self) -> u64

Convert back into u64

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 TokenID for f32

Source§

fn zero() -> Self

Source§

fn coerce(t: u64) -> Self

Source§

fn restore(self) -> u64

Source§

impl TokenID for f64

Source§

fn zero() -> Self

Source§

fn coerce(t: u64) -> Self

Source§

fn restore(self) -> u64

Source§

impl TokenID for i32

Source§

fn zero() -> Self

Source§

fn coerce(t: u64) -> Self

Source§

fn restore(self) -> u64

Source§

impl TokenID for i64

Source§

fn zero() -> Self

Source§

fn coerce(t: u64) -> Self

Source§

fn restore(self) -> u64

Source§

impl TokenID for u64

Source§

fn zero() -> Self

Source§

fn coerce(t: u64) -> Self

Source§

fn restore(self) -> u64

Implementors§