[][src]Struct boxing_arena::BoxingArena

pub struct BoxingArena<T> { /* fields omitted */ }

The BoxingArena struct.


impl<T> BoxingArena<T>[src]

pub fn new() -> Self[src]

Create a new BoxingArena. All memory used by empty boxes will be de-allocated when the BoxingArena is dropped. No allocation is made by this function.

pub fn with_capacity(size: usize) -> Self[src]

Create a new BoxingArena with the given capacity of free boxes.

pub fn unbox(&mut self, v: Box<T>) -> T[src]

This function unboxes the value but keeps the allocation for later reuse by the rebox function.

pub fn rebox(&mut self, v: T) -> Box<T>[src]

When boxing a value, the arena either allocates a new Box or uses an existing empty allocation from a previous 'unbox` operation. In the latter case, allocation would be very fast, and the overhead would be mostly the move into the box.

pub fn try_rebox(&mut self, v: &mut Option<T>) -> Option<Box<T>>[src]

Like rebox but only if there are empty boxes. Return None if *v is None. The stack overhead of this function is guaranteed in the order of pointer-sized.

pub fn capacity(&self) -> usize[src]

Return the number of free boxes in the BoxingArena.

pub fn resize_capacity(&mut self, size: usize)[src]

Resize boxes pool to a given capacity.

pub fn trim(&mut self, size: usize)[src]

Trims capacity to the given size if it is larger.

Trait Implementations

impl<T> Drop for BoxingArena<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BoxingArena<T> where
    T: RefUnwindSafe

impl<T> !Send for BoxingArena<T>

impl<T> !Sync for BoxingArena<T>

impl<T> Unpin for BoxingArena<T>

impl<T> UnwindSafe for BoxingArena<T> where
    T: RefUnwindSafe

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.