pub struct LockedAllocator<A: Allocator>(pub Mutex<A>);Expand description
A simple wrapper around spin::Mutex to enable trait implementations.
Tuple Fields§
§0: Mutex<A>Implementations§
Source§impl<A> LockedAllocator<A>where
A: Allocator,
impl<A> LockedAllocator<A>where
A: Allocator,
pub const fn new(allocator: A) -> Self
pub fn lock(&self) -> MutexGuard<'_, A>
Trait Implementations§
Source§impl<A: Allocator> Allocator for LockedAllocator<A>
impl<A: Allocator> Allocator for LockedAllocator<A>
fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>
unsafe fn deallocate(&self, pointer: *mut u8, layout: Layout)
unsafe fn reallocate( &self, pointer: *mut u8, oldSize: usize, layout: Layout, ) -> Option<NonNull<u8>>
unsafe fn allocate_aligned(&self, layout: Layout) -> Option<NonNull<u8>>
unsafe fn deallocate_aligned(&self, pointer: *mut u8, layout: Layout)
Auto Trait Implementations§
impl<A> !Freeze for LockedAllocator<A>
impl<A> !RefUnwindSafe for LockedAllocator<A>
impl<A> Send for LockedAllocator<A>where
A: Send,
impl<A> Sync for LockedAllocator<A>where
A: Send,
impl<A> Unpin for LockedAllocator<A>where
A: Unpin,
impl<A> UnwindSafe for LockedAllocator<A>where
A: UnwindSafe,
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