[−][src]Trait dynvec::Region
Represents a region of the memory. Objects can be allocated into this region. Regions can carry additional data with each allocation.
Associated Types
Loading content...Required methods
pub fn allocate(&mut self, layout: Layout, header: H) -> Result<*mut u8, H>
[src]
Finds a free location within this region that is:
- Properly aligned to
layout.align
layout.size
bytes long
Returns
The pointer is returned if the allocation is successful and the provided header is given back in the error if the allocation could not be done.
pub fn deallocate(&mut self, ptr: *mut u8) -> Option<H>
[src]
Deallocates the memory allocated at the given pointer.
Returns
If the given pointer was not allocated in this region, None
is returned. Otherwise, the header is returned.
Safety
- The old value must've been properly dropped.
pub fn has_allocated(&self, ptr: *mut u8) -> bool
[src]
Checks whether the given pointer is allocated in this region.
pub fn allocations(&self) -> Self::Pointers
[src]
Returns an iterator over all the allocations of this region.
pub fn count(&self) -> usize
[src]
Returns the number of allocations this region has.
Provided methods
pub fn deallocate_all(&mut self) -> DeallocateAll<'_, H, Self> where
Self: Sized,
[src]
Self: Sized,
Returns an iterator that causes all allocations to be deallocated. The iterator yield the headers.