pub struct LogosDenseI64Map { /* private fields */ }Expand description
Direct-addressed i64 → i64 map — the densest representation of a
Map of Int to Int, emitted when the compiler PROVES every key ever inserted
or queried lands in a statically bounded window [lo, lo + slots) whose width
is ≤ the map’s own with capacity hint. Keys index a flat value array
(data[key - lo]); a parallel presence bitset distinguishes a stored value
from an absent slot, so get returns None for an in-range key that was
never inserted. No hashing, no probing, no sparse table — both build and scan
phases are sequential array accesses, which the backend vectorizes and the
prefetcher loves. This is perfect hashing for dense integer keys: it removes
the random-access hash table that costs LogosI64Map its cache locality.
Implementations§
Source§impl LogosDenseI64Map
impl LogosDenseI64Map
pub fn new() -> Self
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
A window [0, cap) — the offset-free form. Mirrors the LogosI64Map
constructor name so a non-offset dense map reuses the same emission.
Sourcepub fn with_bounds(lo: i64, slots: usize) -> Self
pub fn with_bounds(lo: i64, slots: usize) -> Self
A window [lo, lo + slots). slots is sized to the proven capacity hint;
the soundness gate guarantees every key falls inside, so key - lo is a
valid index for every insert and get the program performs.
pub fn insert(&mut self, key: i64, value: i64)
pub fn get(&self, key: &i64) -> Option<i64>
pub fn contains_key(&self, key: &i64) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for LogosDenseI64Map
impl Clone for LogosDenseI64Map
Source§fn clone(&self) -> LogosDenseI64Map
fn clone(&self) -> LogosDenseI64Map
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more