Crate typed_index_collection
source ·Expand description
Collections of objects with typed indices and buildin identifier support.
Macros
- Implements the Id trait for an object. For example, if an object Animal has a field ‘species_id’ which is a pointer toward another Object of type Species, you can implements Id with the following example. You can also implement Id for Animal itself (the identifier of an Animal is its own field that must be named
id
). - Implement trait
WithId
automatically for a type.
Structs
- The
Collection
object looks like aMap<Idx<T>, T>
, with opaque keys. Then, you can easily store indices and don’t mess up between different types of indices. - A
Collection
with identifier support. - Typed index.
- The structure returned by
CollectionWithId::index_mut
.
Enums
- Typed error for
typed_index_collection
.
Traits
- An object that has a unique identifier.
- An object that can be assigned an identifier.
Type Definitions
- The type returned by
collection::iter
.