NumericId

Trait NumericId 

Source
pub trait NumericId:
    Copy
    + Clone
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Hash
    + Send
    + Sync {
    type Rep;
    type Atomic;

    // Required methods
    fn new(val: Self::Rep) -> Self;
    fn from_usize(index: usize) -> Self;
    fn index(self) -> usize;
    fn rep(self) -> Self::Rep;

    // Provided method
    fn inc(self) -> Self { ... }
}
Expand description

A trait describing “newtypes” that wrap an integer.

Required Associated Types§

Required Methods§

Source

fn new(val: Self::Rep) -> Self

Source

fn from_usize(index: usize) -> Self

Source

fn index(self) -> usize

Source

fn rep(self) -> Self::Rep

Provided Methods§

Source

fn inc(self) -> Self

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 NumericId for usize

Source§

type Rep = usize

Source§

type Atomic = AtomicUsize

Source§

fn new(val: usize) -> Self

Source§

fn from_usize(index: usize) -> Self

Source§

fn rep(self) -> usize

Source§

fn index(self) -> usize

Implementors§