bevy_ecs::storage

Trait SparseSetIndex

Source
pub trait SparseSetIndex:
    Clone
    + PartialEq
    + Eq
    + Hash {
    // Required methods
    fn sparse_set_index(&self) -> usize;
    fn get_sparse_set_index(value: usize) -> Self;
}
Expand description

Represents something that can be stored in a SparseSet as an integer.

Ideally, the usize values should be very small (ie: incremented starting from zero), as the number of bits needed to represent a SparseSetIndex in a FixedBitSet is proportional to the value of those usize.

Required Methods§

Source

fn sparse_set_index(&self) -> usize

Gets the sparse set index corresponding to this instance.

Source

fn get_sparse_set_index(value: usize) -> Self

Creates a new instance of this type with the specified index.

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 SparseSetIndex for u8

Source§

impl SparseSetIndex for u16

Source§

impl SparseSetIndex for u32

Source§

impl SparseSetIndex for u64

Source§

impl SparseSetIndex for usize

Implementors§