pub struct DynAlloc<'a> { /* private fields */ }
Implementations§
Source§impl<'a> DynAlloc<'a>
impl<'a> DynAlloc<'a>
pub fn try_new_unclone<A: 'a + Allocator + Send>(alloc: A) -> Result<Self, A>
pub fn try_new_clone<A: 'a + Clone + Allocator + Send>( alloc: A, ) -> Result<Self, A>
pub fn from_ref<A: Allocator + Sync>(alloc: &'a A) -> Self
pub fn from_mut<A: Allocator + Send>(alloc: &'a mut A) -> Self
pub fn by_mut(&mut self) -> DynAlloc<'_>
pub fn cloneable(&self) -> bool
Trait Implementations§
Source§impl Allocator for DynAlloc<'_>
impl Allocator for DynAlloc<'_>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
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)
Deallocates the memory referenced by
ptr
. Read moreSource§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Behaves like
allocate
, but also ensures that the returned memory is zero-initialized. 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>
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>
Behaves like
grow
, but also ensures that the new contents are set to zero before being
returned. Read moreimpl Send for DynAlloc<'_>
Auto Trait Implementations§
impl<'a> !Freeze for DynAlloc<'a>
impl<'a> !RefUnwindSafe for DynAlloc<'a>
impl<'a> !Sync for DynAlloc<'a>
impl<'a> Unpin for DynAlloc<'a>
impl<'a> UnwindSafe for DynAlloc<'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