Trait idmap::table::IdTable
[−]
[src]
pub trait IdTable: Debug + Clone { fn new() -> Self; fn with_capacity(capacity: usize) -> Self; fn get(&self, key_index: TableIndex) -> Option<TableIndex>; fn create_mut(&mut self, key_index: TableIndex) -> &mut TableIndex; fn set_raw(&mut self, key_index: TableIndex, value: TableIndex); fn clear(&mut self); fn reserve(&mut self, amount: usize); }
Assigns unique u32
indexes to each IntegerId
key,
which can be used to modify the behavior and performance of a DenseEntryTable
.
Currently the only implementation is OrderedIdTable
,
which preserves ordering by using a Vec
DenseEntryTable
s need a seperate IdTable
since entries will be stored densely,
though a DirectEntryTable
doesn't need one at all.
Required Methods
fn new() -> Self
fn with_capacity(capacity: usize) -> Self
fn get(&self, key_index: TableIndex) -> Option<TableIndex>
Determine the index of the specified key, which may or may not be valid.
In other words this may have 'false positives',
so that Some(TableIndex::from(key))
is a correct implementation even though
the index isn't necessarily in-bounds for the entry table.
However, it can never have 'false negatives' so None
and Some(TableIndex::INVALID)
are both wrong.
The TableIndex::INVALID
index is special case and should never be considered valid
under any circumstances.
It is logically equivelant to a None
result, but kept for performance reasons.
fn create_mut(&mut self, key_index: TableIndex) -> &mut TableIndex
fn set_raw(&mut self, key_index: TableIndex, value: TableIndex)
fn clear(&mut self)
fn reserve(&mut self, amount: usize)
Implementors
impl IdTable for OrderedIdTable