Id

pub trait Id:
    Copy
    + Eq
    + Hash {
    type RawId;

    // Required methods
    fn from_offset(inner: usize) -> Self;
    fn to_raw_id(&self) -> Self::RawId;

    // Provided method
    fn into_raw_id(self) -> Self::RawId { ... }
}

Required Associated Types§

Required Methods§

Source

fn from_offset(inner: usize) -> Self

Convert from a usize offset into an Id. This should be loss-less except for certain edges.

§Panics

Panic if the usize cannot be represented in the Id, for instance if the offset cannot fit in the underlying integer type. This is expected to be ultra-rare (more than u32::MAX-1 items created?!).

Source

fn to_raw_id(&self) -> Self::RawId

Provided Methods§

Source

fn into_raw_id(self) -> Self::RawId

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.

Implementors§