pub struct Allocator { /* private fields */ }
Expand description
Allocator applicable for standard containers to make them persistent.
Create crate::Writer
by crate::Holder::write
in the same thread for
allocation, deallocation and other persistent storage update.
Trait Implementations§
Source§impl Allocator for Allocator
impl Allocator for Allocator
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, p: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, p: 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,
p: NonNull<u8>,
old: Layout,
new: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, p: NonNull<u8>, old: Layout, new: 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 shrink(
&self,
p: NonNull<u8>,
old: Layout,
new: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn shrink( &self, p: NonNull<u8>, old: Layout, new: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Attempts to shrink the memory block. 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 moreAuto Trait Implementations§
impl Freeze for Allocator
impl RefUnwindSafe for Allocator
impl Send for Allocator
impl Sync for Allocator
impl Unpin for Allocator
impl UnwindSafe for Allocator
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