[−][src]Trait alloc_compose::AllocAll
Required methods
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
Attempts to allocate all of the memory the allocator can provide.
If the allocator is currently not managing any memory, then it returns all the memory available to the allocator. Subsequent calls should not suceed.
On success, returns a [NonNull<[u8]>
] meeting the size and alignment guarantees of layout
.
The returned block may have a larger size than specified by layout.size()
, and may or may
not have its contents initialized.
[NonNull<[u8]>
]: NonNull
Errors
Returning Err
indicates that either memory is exhausted or layout
does not meet
allocator's size or alignment constraints.
Implementations are encouraged to return Err
on memory exhaustion rather than panicking or
aborting, but this is not a strict requirement. (Specifically: it is legal to implement
this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to
call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
Behaves like alloc_all
, but also ensures that the returned memory is zero-initialized.
Errors
Returning Err
indicates that either memory is exhausted or layout
does not meet
allocator's size or alignment constraints.
Implementations are encouraged to return Err
on memory exhaustion rather than panicking or
aborting, but this is not a strict requirement. (Specifically: it is legal to implement
this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to
call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
fn dealloc_all(&mut self)
Deallocates all the memory the allocator had allocated.
fn capacity(&self) -> usize
Returns the total capacity available in this allocator.
fn capacity_left(&self) -> usize
Returns the free capacity left for allocating.
Provided methods
fn is_empty(&self) -> bool
Returns if the allocator is currently not holding memory.
fn is_full(&self) -> bool
Returns if the allocator has no more capacity left.
Implementors
impl AllocAll for Null
[src]
fn alloc_all(&mut self, _layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
_layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
_layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
fn capacity(&self) -> usize
[src]
fn capacity_left(&self) -> usize
[src]
impl<'_> AllocAll for Region<'_>
[src]
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
fn capacity(&self) -> usize
[src]
fn capacity_left(&self) -> usize
[src]
impl<A: AllocAll, C: CallbackRef> AllocAll for Proxy<A, C>
[src]
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
fn capacity(&self) -> usize
[src]
fn capacity_left(&self) -> usize
[src]
fn is_empty(&self) -> bool
[src]
fn is_full(&self) -> bool
[src]
impl<A: AllocAll, const SIZE: usize> AllocAll for Chunk<A, SIZE> where
Self: SizeIsPowerOfTwo,
[src]
Self: SizeIsPowerOfTwo,
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
fn capacity(&self) -> usize
[src]
fn capacity_left(&self) -> usize
[src]
impl<Alloc, Prefix, Suffix> AllocAll for Affix<Alloc, Prefix, Suffix> where
Alloc: AllocAll,
[src]
Alloc: AllocAll,
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
fn capacity(&self) -> usize
[src]
fn capacity_left(&self) -> usize
[src]
impl<Small, Large, const THRESHOLD: usize> AllocAll for Segregate<Small, Large, THRESHOLD> where
Small: AllocAll,
Large: AllocAll,
[src]
Small: AllocAll,
Large: AllocAll,
fn alloc_all(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr>
[src]
fn alloc_all_zeroed(
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
[src]
&mut self,
layout: Layout
) -> Result<NonNull<[u8]>, AllocErr>
fn dealloc_all(&mut self)
[src]
Deallocates all the memory the allocator had allocated.
fn capacity(&self) -> usize
[src]
Returns the total capacity available in this allocator.
fn capacity_left(&self) -> usize
[src]
Returns the free capacity left for allocating.