Expand description
Strongly typed identifiers and registries.
This module provides:
Identifier: a trait for strongly typed IDs backed byusizeIdentified<Id, T>: a value paired with its typed IDRegistry<Id, T>: a typed vector indexed byId
§Example
use jstd::Identifier;
use jstd::registry::Registry;
#[derive(Identifier)]
struct NodeId(usize);
let mut registry = Registry::<NodeId, &str>::default();
let a = registry.push("a");
let b = registry.push("b");
assert_eq!(usize::from(a), 0);
assert_eq!(usize::from(b), 1);
assert_eq!(registry[a], "a");
assert_eq!(registry[b], "b");Structs§
- Identified
- A value paired with its typed identifier.
- Into
Iter - Iter
- IterMut
- Registry
- A strongly typed vector
Traits§
- Identifier
- Typed identifier trait used by
Registry.