[−][src]Trait alloc_compose::AllocateAll
Extends AllocRef
for allocating or deallocating all memory at once.
Required methods
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
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 are unlikely to succeed.
On success, returns [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.
Also see AllocRef::alloc
Errors
Returning Err
indicates that either memory is exhausted or layout
does not meet
allocators 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.
pub fn deallocate_all(&self)
[src]
Deallocates all the memory the allocator had allocated.
pub fn capacity(&self) -> usize
[src]
Returns the total capacity available in this allocator.
pub fn capacity_left(&self) -> usize
[src]
Returns the free capacity left for allocating.
Provided methods
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
Behaves like alloc_all
, but also ensures that the returned memory is zero-initialized.
Also see AllocRef::alloc_zeroed
Errors
Returning Err
indicates that either memory is exhausted or layout
does not meet
allocators 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.
pub fn is_empty(&self) -> bool
[src]
Returns if the allocator is currently not holding memory.
pub fn is_full(&self) -> bool
[src]
Returns if the allocator has no more capacity left.
Implementations on Foreign Types
impl<A: ?Sized> AllocateAll for Box<A> where
A: AllocateAll,
[src]
A: AllocateAll,
alloc
only.pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_full(&self) -> bool
[src]
impl<A: ?Sized> AllocateAll for Rc<A> where
A: AllocateAll,
[src]
A: AllocateAll,
alloc
only.pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_full(&self) -> bool
[src]
impl<A: ?Sized> AllocateAll for Arc<A> where
A: AllocateAll,
[src]
A: AllocateAll,
alloc
only.pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_full(&self) -> bool
[src]
Implementors
impl AllocateAll for RawIntrusiveRegion
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl AllocateAll for RawRegion
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl AllocateAll for RawSharedRegion
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl AllocateAll for Null
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl<'_> AllocateAll for IntrusiveRegion<'_>
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl<'_> AllocateAll for Region<'_>
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl<'_> AllocateAll for SharedRegion<'_>
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
impl<A: AllocateAll, C: CallbackRef> AllocateAll for Proxy<A, C>
[src]
pub fn allocate_all(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn allocate_all_zeroed(&self) -> Result<NonNull<[u8]>, AllocError>
[src]
pub fn deallocate_all(&self)
[src]
pub fn capacity(&self) -> usize
[src]
pub fn capacity_left(&self) -> usize
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_full(&self) -> bool
[src]
impl<A: ?Sized, '_> AllocateAll for &'_ A where
A: AllocateAll,
[src]
A: AllocateAll,