[−][src]Struct boxing_arena::BoxingArena
The BoxingArena struct.
Methods
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,
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,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,