pub struct RingBox<T: 'static> { /* private fields */ }
Expand description
Owned pointer into a RingBuffer
.
RingBuffer::free_box
instead of drop
!
Implementations§
Source§impl<T> RingBox<T>
impl<T> RingBox<T>
Sourcepub fn into_parts(self) -> (Box<T>, RingAllocationMetadata)
pub fn into_parts(self) -> (Box<T>, RingAllocationMetadata)
Splits this RingBox
into its raw parts. Can be combined back with
RingBox::from_parts
.
Useful for cases where some API is expecting a Box
and a deref isn’t
enough.
Sourcepub unsafe fn from_parts(
boxed: Box<T>,
metadata: RingAllocationMetadata,
) -> RingBox<T>
pub unsafe fn from_parts( boxed: Box<T>, metadata: RingAllocationMetadata, ) -> RingBox<T>
§Safety
The parts passed in must be a pair returned by an earlier
RingBox::into_parts
call. Mixing up metadatas and boxes is not
allowed, because it will result in aliased mutable borrows, so
definitely very Undefined-Behavior.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RingBox<T>
impl<T> RefUnwindSafe for RingBox<T>where
T: RefUnwindSafe,
impl<T> !Send for RingBox<T>
impl<T> Sync for RingBox<T>where
T: Sync,
impl<T> Unpin for RingBox<T>
impl<T> UnwindSafe for RingBox<T>where
T: RefUnwindSafe,
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