Crate zng_unique_id
source ·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§
- Declares a patchable static.
- Static reference to a
hot_static!
. - Implement
bytemuck
trait for the unique ID. - Implement debug and display for an unique ID type that also implements name.
- Extend an unique ID type to have an optional attached name string, also implements.
- Implementation of
lazy_static!
that supports hot reloading. - Declares a static unique ID that is lazy inited.
- Declare a new unique id type that is backed by a
NonZeroU32
. - Declare a new unique id type that is backed by a
NonZeroU64
.
Structs§
- Build
IdHasher
. - No-op hasher.
- Map specialized for unique IDs that are already a randomized hash.
- Set specialized for unique IDs that are already a randomized hash.
Enums§
- Error when trying to associate give a name with an existing id.
Traits§
- Trait implemented for all generated unique ID types.
Functions§
- Initializes a
lazy_static!
with a custom value if it is not yet inited.