Struct idmap::table::TableIndex
[−]
[src]
pub struct TableIndex(_);
The index of an entry in either IdTable
or EntryTable
.
The marker index TableIndex::INVALID
is used to indicate missing entries.
Methods
impl TableIndex
[src]
pub const INVALID: TableIndex
INVALID: TableIndex = TableIndex(<u32>::max_value())
The special marker index for a missing/invalid entry, which may be used by a table to indicate that an entry is missing.
This is used instead of an Option
for performance reasons,
as it can often be internally folded into a bounds check
which would otherwise need a seperate check.
pub fn from_key<T: IntegerId>(key: &T) -> Self
[src]
pub fn from_index(index: usize) -> Self
[src]
pub fn index(self) -> Option<u32>
[src]
Give the underlying value of this index, or None
if it's invalid.
pub fn unwrap_index(self) -> u32
[src]
Unwrap the underlying value of this index, without checking validity in release builds.
This is completely safe to make this a debug-check since it's already going to be bounds checked.
pub fn offset(self, amount: u32) -> Self
[src]
pub fn raw_index(self) -> u32
[src]
Give the internal value of this index, even if it's invalid.
pub fn is_valid(self) -> bool
[src]
Check if the index is valid and not equal to TableIndex::INVALID
Trait Implementations
impl Copy for TableIndex
[src]
impl Clone for TableIndex
[src]
fn clone(&self) -> TableIndex
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialOrd for TableIndex
[src]
fn partial_cmp(&self, __arg_0: &TableIndex) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq for TableIndex
[src]
fn eq(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &TableIndex) -> bool
[src]
This method tests for !=
.
impl Eq for TableIndex
[src]
impl Ord for TableIndex
[src]
fn cmp(&self, __arg_0: &TableIndex) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more