pub struct DictTable { /* private fields */ }Implementations§
Source§impl DictTable
impl DictTable
pub fn new() -> Self
pub fn with_capacity(n: usize) -> Self
Sourcepub fn try_with_capacity(n: usize) -> Result<Self, Layout>
pub fn try_with_capacity(n: usize) -> Result<Self, Layout>
As DictTable::with_capacity, but returns the layout the allocator refused instead
of aborting.
Sourcepub fn try_record(n: usize) -> Result<Self, Layout>
pub fn try_record(n: usize) -> Result<Self, Layout>
As DictTable::record, but returns the layout the allocator refused instead of
aborting.
Sourcepub fn slot_value(&self, slot: usize) -> Option<Value>
pub fn slot_value(&self, slot: usize) -> Option<Value>
The value in slot of a shape-mode table.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn version(&self) -> u64
pub fn heap_bytes(&self) -> usize
Sourcepub fn trace_written(&self, t: &mut Tracer)
pub fn trace_written(&self, t: &mut Tracer)
For a minor collection of the owner: marks the entries written since the last one (see
WordBuf::note_written) and forgets them. Entry i covers words i * W..i * W + W of
the entry buffer in table mode, word i in shape mode.
Sourcepub fn raw_len(&self) -> usize
pub fn raw_len(&self) -> usize
Number of entry slots in use, tombstones included (for indexed iteration that tolerates growth).
pub fn raw_entry(&self, i: usize) -> Option<Entry>
pub fn first_live(&self) -> Option<usize>
pub fn probe(&self, hash: u64, key: Value) -> Probe
Sourcepub fn read_optimistic<R>(&self, f: &impl Fn(&DictTable) -> R) -> Option<R>
pub fn read_optimistic<R>(&self, f: &impl Fn(&DictTable) -> R) -> Option<R>
Runs the read f without the lock, retrying while writes overlap it. None means it kept
colliding with writers; the caller should take the lock. f must only read the table.
Sourcepub unsafe fn set_value_at(&self, idx: usize, v: Value, access: Access)
pub unsafe fn set_value_at(&self, idx: usize, v: Value, access: Access)
§Safety
The caller has write access (see above).
Sourcepub unsafe fn insert_new(
&self,
hash: u64,
key: Value,
value: Value,
access: Access,
)
pub unsafe fn insert_new( &self, hash: u64, key: Value, value: Value, access: Access, )
Appends a new entry (the caller has established the key is absent). Aborts if the table
cannot grow; see DictTable::try_insert_new.
§Safety
The caller has write access.
Sourcepub unsafe fn try_insert_new(
&self,
hash: u64,
key: Value,
value: Value,
access: Access,
) -> Result<(), Layout>
pub unsafe fn try_insert_new( &self, hash: u64, key: Value, value: Value, access: Access, ) -> Result<(), Layout>
As DictTable::insert_new, but if the allocator refuses to grow the table, returns
the refused layout and leaves the table as it was.
§Safety
The caller has write access.