pub struct DefinitionId(/* private fields */);Expand description
A tagged 64-bit identifier for any definition in a compiled story.
Layout: [tag: 8 bits][hash: 56 bits]
Implementations§
Source§impl DefinitionId
impl DefinitionId
Sourcepub const RNG_CELL: DefinitionId
pub const RNG_CELL: DefinitionId
The well-known cell id of the std::rand RNG state cell (NS-A6,
docs/stdlib-spec.md §7, ruled 2026-07-18): RNG state is a named
runtime state cell, and every draw is an ordinary write to it in a
definition’s effect row — no new row dimension. This constant is that
cell’s name in the DefinitionId space shared by the effect-row
machinery (brink-analyzer’s harvest, @[effects(…)] assertions,
the wake-condition purity gate) and the runtime’s ground-truth
recorder (brink-runtime::effect_trace).
The cell is compiler-owned — no source declaration mints it — so its
hash is a fixed, documented constant rather than a content hash. A
collision with a real content-hashed GlobalVar would require a
user VAR/CONST to hash to exactly this 56-bit value (probability
2⁻⁵⁶ per global; hash_qualified_name output is uniform), which is
the same residual risk every pair of user globals already carries.
The cell’s runtime representation is not a Value slot: it is the
(rng_seed, previous_random) pair ContextAccess has always carried
(and saves have always round-tripped). This id names that state for
the effect system; it never appears in a global table.
Sourcepub fn new(tag: DefinitionTag, hash: u64) -> Self
pub fn new(tag: DefinitionTag, hash: u64) -> Self
Create a new id from a tag and a 56-bit hash.
The hash is masked to 56 bits — upper bits are silently discarded.
Sourcepub fn tag(self) -> DefinitionTag
pub fn tag(self) -> DefinitionTag
Extract the tag byte.
Trait Implementations§
Source§impl Clone for DefinitionId
impl Clone for DefinitionId
Source§fn clone(&self) -> DefinitionId
fn clone(&self) -> DefinitionId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more