Expand description
Macros for generating unique ID types.
§Crate
This crate is part of the zng
project.
§Cargo Features
This crate provides 2 feature flags, 1 enabled by default.
§"named"
Enable associated names for ID types.
Enabled by default.
§"hot_reload"
Enable static
patching for ID types.
The hot_reload
feature on the main crate uses this to ensure IDs generated by dynamically
loaded libraries are unique across the running process.
Macros§
- hot_
static - Declares a patchable static.
- hot_
static_ ref - Static reference to a
hot_static!
. - impl_
unique_ id_ bytemuck - Implement
bytemuck
trait for the unique ID. - impl_
unique_ id_ fmt - Implement debug and display for an unique ID type that also implements name.
- impl_
unique_ id_ name - Extend an unique ID type to have an optional attached name string, also implements.
- lazy_
static - Implementation of
lazy_static!
that supports hot reloading. - static_
id - Declares a static unique ID that is lazy inited.
- unique_
id_ 32 - Declare a new unique id type that is backed by a
NonZeroU32
. - unique_
id_ 64 - Declare a new unique id type that is backed by a
NonZeroU64
.
Structs§
- Build
IdHasher - Build
IdHasher
. - IdHasher
- No-op hasher.
- IdMap
- Map specialized for unique IDs that are already a randomized hash.
- IdSet
- Set specialized for unique IDs that are already a randomized hash.
Enums§
- IdName
Error - Error when trying to associate give a name with an existing id.
Traits§
- Unique
Id - Trait implemented for all generated unique ID types.
Functions§
- lazy_
static_ init - Initializes a
lazy_static!
with a custom value if it is not yet inited.
Type Aliases§
- IdEntry
- Entry in
IdMap
. - IdOccupied
Entry - Occupied entry in an
IdEntry
. - IdVacant
Entry - Vacant entry in an
IdEntry
.