Trait indexed::Indexed [−][src]
Type of elements in the Pool
must implement this trait.
Typically some integer field in the type must devote to storing the index in the pool, and it is not necessarily usize.
For example, an index can be stored in u32 if 4194304K is enough for anybody.
Required methods
unsafe fn get_index(&self) -> usize
[src]
Gets the element’s index in the pool.
unsafe fn set_index(&mut self, index: usize)
[src]
Sets the element’s index in the pool. The library user is not expected to call it directly.
Provided methods
fn chunk_len() -> ChunkLen
[src]
Sets the underlying chunk size. The default is 256, and can be overrided by those values defined in ChunkLen
.
fn null() -> usize
[src]
Defines which index value is for null. If the underlying storage for index is smaller than usize
’s size, the library user should override this method and pick a smaller value, e.g !0_u32
for index stored in u32
.
Note that it is for convenience only, and the library will not do any index check against null()
.
fn pool(&self) -> &Pool<Self>
[src]
Obtains reference of its pool.
unsafe fn pool_mut(&self) -> &mut Pool<Self>
[src]
Obtains mutable reference of its pool.
fn pool_non_null(&self) -> NonNull<Pool<Self>>
[src]
Obtains non null pointer of its pool.
fn pool_push(&self, value: Self)
[src]
Appends an element to the back of its pool.
unsafe fn pool_write(&self, index: usize, value: Self)
[src]
Overwrites a new value into its pool at given index without reading or dropping the old value.
fn pool_reserve(&self, additional: usize)
[src]
Reserves capacity for at least additional more elements to be inserted in the given Poolchunk_len()
.
After calling reserve, capacity will be greater than or equal to self.pool().new_index() + additional.
Does nothing if capacity is already sufficient.