pub struct Freelist<Limit: LimitParam, A: Allocator + Clone> { /* private fields */ }
Implementations§
Source§impl<Limit: LimitParam, A: Allocator + Clone> Freelist<Limit, A>
impl<Limit: LimitParam, A: Allocator + Clone> Freelist<Limit, A>
pub const fn new( layout: Layout, tolerance: Layout, limit: Limit, base: A, ) -> Self
Sourcepub const unsafe fn new_unchecked(
layout: Layout,
tolerance: Layout,
limit: Limit,
base: A,
) -> Self
pub const unsafe fn new_unchecked( layout: Layout, tolerance: Layout, limit: Limit, base: A, ) -> Self
§Safety
Arguments should satisfy
tolerance.size() <= layout.size() && tolerance.align() <= layout.align()
,
and
layout.size() >= MIN_LAYOUT_SIZE && layout.align() >= MIN_LAYOUT_ALIGN
.
Trait Implementations§
Source§impl<Limit: LimitParam, A: Allocator + Clone> Allocator for Freelist<Limit, A>
impl<Limit: LimitParam, A: Allocator + Clone> Allocator for Freelist<Limit, A>
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§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 moreSource§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 moreSource§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
Source§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<Limit: LimitParam, A: Fallbackable + Clone> Fallbackable for Freelist<Limit, A>
impl<Limit: LimitParam, A: Fallbackable + Clone> Fallbackable for Freelist<Limit, A>
impl<Limit: LimitParam, A: NonUnwinding + Clone> NonUnwinding for Freelist<Limit, A>
Auto Trait Implementations§
impl<Limit, A> !Freeze for Freelist<Limit, A>
impl<Limit, A> !RefUnwindSafe for Freelist<Limit, A>
impl<Limit, A> Send for Freelist<Limit, A>
impl<Limit, A> Sync for Freelist<Limit, A>
impl<Limit, A> Unpin for Freelist<Limit, A>
impl<Limit, A> !UnwindSafe for Freelist<Limit, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more