Skip to main content

Id

Trait Id 

Source
pub trait Id:
    Copy
    + Clone
    + Eq
    + PartialEq
    + Debug
    + Into<u64>
    + From<u64> {
    const NONE: Self;

    // Provided methods
    fn none() -> Self { ... }
    fn is_none(&self) -> bool { ... }
    fn as_u64(&self) -> u64 { ... }
    fn from_u64(val: u64) -> Self { ... }
}
Expand description

Id 基础 trait,所有自定义 Id 需实现此 trait

Required Associated Constants§

Source

const NONE: Self

Provided Methods§

Source

fn none() -> Self

Source

fn is_none(&self) -> bool

Source

fn as_u64(&self) -> u64

快速转换为 u64

Source

fn from_u64(val: u64) -> Self

从 u64 构建 Id

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§

Source§

impl Id for DefaultId

Source§

const NONE: Self