Crate cranelift_entity[][src]

Array-based data structures using densely numbered entity references as mapping keys.

This crate defines a number of data structures based on arrays. The arrays are not indexed by usize as usual, but by entity references which are integers wrapped in new-types. This has a couple advantages:

The EntityRef trait should be implemented by types to be used as indexed. The entity_impl! macro provides convenient defaults for types wrapping u32 which is common.

Modules

packed_option

Compact representation of Option<T> for types with a reserved value.

Macros

entity_impl

Macro which provides the common implementation of a 32-bit entity reference.

Structs

BoxedSlice

A slice mapping K -> V allocating dense entity references.

EntityList

A small list of entity references allocated from a pool.

EntitySet

A set of K for densely indexed entity references.

Iter

Iterate over all keys in order.

IterMut

Iterate over all keys in order.

Keys

Iterate over all keys in order.

ListPool

A memory pool for storing lists of T.

PrimaryMap

A primary mapping K -> V allocating dense entity references.

SecondaryMap

A mapping K -> V for densely indexed entity references.

SparseMap

A sparse mapping of entity references.

Traits

EntityRef

A type wrapping a small integer index should implement EntityRef so it can be used as the key of an SecondaryMap or SparseMap.

SparseMapValue

Trait for extracting keys from values stored in a SparseMap.

Type Definitions

SparseSet

A sparse set of entity references.