[−][src]Struct pleco_engine::tables::TableBase
Generic Heap-stored array of entries. Used for building more specific abstractions.
Objects placed inside must not implement Drop
, or else undefined behavior follows. Indexing is done
with u64
s, and returns a value using a mask of the lower log2(table size) bits. Collisions
are possible using this structure, although very rare.
Methods
impl<T: Sized + TableBaseConst> TableBase<T>
[src]
pub fn new() -> Option<TableBase<T>>
[src]
Constructs a new TableBase
. The size must be a power of 2, or else None
is
returned.
Safety
Size must be a power of 2/
pub fn get_mut(&mut self, key: u64) -> &mut T
[src]
Gets a mutable reference to an entry with a certain key.
pub unsafe fn get_ptr(&self, key: u64) -> *mut T
[src]
Gets a mutable pointer to an entry with a certain key.
Safety
Unsafe due to returning a raw pointer that may dangle if the TableBase
is
dropped prematurely.
pub fn clear(&mut self)
[src]
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,