[−][src]Struct chunky::Arena
Stores items of a fixed (max) size consecutively in a collection of chunks
Methods
impl Arena
[src]
pub fn new(
ident: Ident,
chunk_size: usize,
item_size: usize,
storage: Rc<dyn ChunkStorage>
) -> Arena
[src]
ident: Ident,
chunk_size: usize,
item_size: usize,
storage: Rc<dyn ChunkStorage>
) -> Arena
Create a new arena given a chunk group identifier, chunk size and (max) item size
pub fn len(&self) -> usize
[src]
Number of elements in the collection
pub fn is_empty(&self) -> bool
[src]
Is the collection empty?
pub fn push(&mut self) -> (*mut u8, ArenaIndex)
[src]
Allocate space for a new item, returns a pointer to where the new item can be written to and the index that the new item will have.
This is handled like this so items of heterogeneous types or sizes less than the fixed item size can be added to the collection.
pub fn pop_away(&mut self)
[src]
Remove the last item from the end
pub unsafe fn swap_remove(&mut self, index: ArenaIndex) -> Option<*const u8>
[src]
Remove the item at index, by swapping it with the last item and then popping, returning the swapped in item (unless empty).
This is a O(1) way of removing an item if the order of items doesn't matter.
pub unsafe fn at(&self, index: ArenaIndex) -> *const u8
[src]
Get a pointer to the item at index
pub unsafe fn at_mut(&mut self, index: ArenaIndex) -> *mut u8
[src]
Get a mutable pointer to the item at index
Auto Trait Implementations
impl !Sync for Arena
impl !Send for Arena
impl Unpin for Arena
impl !RefUnwindSafe for Arena
impl !UnwindSafe for Arena
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,