pub struct TalcLock<R: RawMutex, S: Source, B: Binning> { /* private fields */ }Expand description
Implementations§
Source§impl<R: RawMutex, S: Source, B: Binning> TalcLock<R, S, B>
impl<R: RawMutex, S: Source, B: Binning> TalcLock<R, S, B>
Sourcepub fn lock(&self) -> MutexGuard<'_, R, Talc<S, B>>
pub fn lock(&self) -> MutexGuard<'_, R, Talc<S, B>>
Lock the mutex and access the inner Talc.
Sourcepub fn try_lock(&self) -> Option<MutexGuard<'_, R, Talc<S, B>>>
pub fn try_lock(&self) -> Option<MutexGuard<'_, R, Talc<S, B>>>
Try to lock the mutex and access the inner Talc.
Sourcepub fn get_mut(&mut self) -> &mut Talc<S, B>
pub fn get_mut(&mut self) -> &mut Talc<S, B>
Returns a mutable reference to the inner Talc.
This avoids locking, as having a mutable reference statically
guarantees that self is not locked.
Sourcepub fn into_inner(self) -> Talc<S, B>
pub fn into_inner(self) -> Talc<S, B>
Retrieve the inner Talc.
Trait Implementations§
Source§impl<R: RawMutex, S: Source, B: Binning> Allocator for TalcLock<R, S, B>
impl<R: RawMutex, S: Source, B: Binning> Allocator for TalcLock<R, S, B>
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§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 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§impl<R: RawMutex, S: Source, B: Binning> GlobalAlloc for TalcLock<R, S, B>
impl<R: RawMutex, S: Source, B: Binning> GlobalAlloc for TalcLock<R, S, B>
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<R, S, B> !Freeze for TalcLock<R, S, B>
impl<R, S, B> !RefUnwindSafe for TalcLock<R, S, B>
impl<R, S, B> Send for TalcLock<R, S, B>
impl<R, S, B> Sync for TalcLock<R, S, B>
impl<R, S, B> Unpin for TalcLock<R, S, B>
impl<R, S, B> UnsafeUnpin for TalcLock<R, S, B>
impl<R, S, B> UnwindSafe for TalcLock<R, S, B>
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