EntityRef

Trait EntityRef 

Source
pub trait EntityRef:
    Clone
    + Copy
    + Debug
    + Hash
    + PartialEq
    + PartialOrd {
    // Required methods
    fn new(value: usize) -> Self;
    fn as_u32(&self) -> u32;
    fn as_usize(&self) -> usize;
}
Expand description

An opaque reference to an entity.

Entity references are intended to be created only internally, and using manually constructed entity references (using EntityRef::new) may cause issues if you do not know what you are doing.

Required Methods§

Source

fn new(value: usize) -> Self

Creates an opaque reference to an entity.

Manually creating an entity reference may cause issues if you do not know what you are doing. Entity references are unchecked for performance reasons, and your program may panic if you create an invalid entity reference.

Source

fn as_u32(&self) -> u32

Returns the raw ID of this entity reference.

Used internally to index an entity list.

Source

fn as_usize(&self) -> usize

Returns the raw ID of this entity reference, as a Rust usize.

Used internally to index an entity list.

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§