[][src]Struct pleco_engine::tables::TableBase

pub struct TableBase<T: Sized + TableBaseConst> { /* fields omitted */ }

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 u64s, 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

impl<T: Sized + TableBaseConst> Drop for TableBase<T>[src]

Auto Trait Implementations

impl<T> !Send for TableBase<T>

impl<T> !Sync for TableBase<T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]