pub struct LinearAllocator;Expand description
[Allocator] struct for LINEAR memory.
To use this struct the main crate must activate the allocator_api unstable feature.
Implementations§
Source§impl LinearAllocator
impl LinearAllocator
Sourcepub fn free_space() -> u32
pub fn free_space() -> u32
Returns the amount of free space left in the LINEAR memory sector.
Trait Implementations§
Source§impl Allocator for LinearAllocator
impl Allocator for LinearAllocator
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to allocate a block of memory. Read more
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, _layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, _layout: Layout)
🔬This is a nightly-only experimental API. (
allocator_api)Deallocates the memory referenced by
ptr. Read more§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
allocate, but also ensures that the returned memory is zero-initialized. Read more§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to extend the memory block. Read more
§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§impl Clone for LinearAllocator
impl Clone for LinearAllocator
Source§fn clone(&self) -> LinearAllocator
fn clone(&self) -> LinearAllocator
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearAllocator
impl Debug for LinearAllocator
Source§impl Default for LinearAllocator
impl Default for LinearAllocator
Source§fn default() -> LinearAllocator
fn default() -> LinearAllocator
Returns the “default value” for a type. Read more
impl Copy for LinearAllocator
impl<T: ?Sized> LinearAllocation for Box<T, LinearAllocator>
Auto Trait Implementations§
impl Freeze for LinearAllocator
impl RefUnwindSafe for LinearAllocator
impl Send for LinearAllocator
impl Sync for LinearAllocator
impl Unpin for LinearAllocator
impl UnwindSafe for LinearAllocator
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)