pub struct OwnedAlloc<P: BufferProvider> { /* private fields */ }Expand description
Pool-owned allocation that is returned to the pool on drop.
Use into_raw to transfer ownership to a descriptor
state that will deallocate the raw Allocation through another path.
Implementations§
Source§impl<P: BufferProvider> OwnedAlloc<P>
impl<P: BufferProvider> OwnedAlloc<P>
Sourcepub fn new(pool: P, alloc: Allocation) -> Self
pub fn new(pool: P, alloc: Allocation) -> Self
Wrap an existing allocation with its owning pool.
Sourcepub fn allocate(pool: P, len: usize) -> Result<Self, AllocError>
pub fn allocate(pool: P, len: usize) -> Result<Self, AllocError>
Allocate from pool and return an owning guard.
Sourcepub fn allocation(&self) -> Allocation
pub fn allocation(&self) -> Allocation
The raw allocation currently owned by this guard.
Sourcepub fn into_raw(self) -> Allocation
pub fn into_raw(self) -> Allocation
Release ownership and return the raw allocation.
Trait Implementations§
Source§impl<P: Debug + BufferProvider> Debug for OwnedAlloc<P>
impl<P: Debug + BufferProvider> Debug for OwnedAlloc<P>
Source§impl<P: BufferProvider> Drop for OwnedAlloc<P>
impl<P: BufferProvider> Drop for OwnedAlloc<P>
Auto Trait Implementations§
impl<P> Freeze for OwnedAlloc<P>where
P: Freeze,
impl<P> RefUnwindSafe for OwnedAlloc<P>where
P: RefUnwindSafe,
impl<P> Send for OwnedAlloc<P>where
P: Send,
impl<P> Sync for OwnedAlloc<P>where
P: Sync,
impl<P> Unpin for OwnedAlloc<P>where
P: Unpin,
impl<P> UnsafeUnpin for OwnedAlloc<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for OwnedAlloc<P>where
P: 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