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§

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§

BuildIdHasher
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§

IdNameError
Error when trying to associate give a name with an existing id.

Traits§

UniqueId
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.
IdOccupiedEntry
Occupied entry in an IdEntry.
IdVacantEntry
Vacant entry in an IdEntry.