pub struct OversizedBox<T: ?Sized, S> { /* private fields */ }
Expand description
A Box
for T
with an allocation whose size and alignment is the same as
S
.
Implementations§
Source§impl<T, S> OversizedBox<T, S>
impl<T, S> OversizedBox<T, S>
Source§impl<T: ?Sized, S> OversizedBox<T, S>
impl<T: ?Sized, S> OversizedBox<T, S>
Sourcepub fn refill<T2>(this: Self, t: T2) -> OversizedBox<T2, S>
pub fn refill<T2>(this: Self, t: T2) -> OversizedBox<T2, S>
Drops the current contents of the box, then replaces them with t
.
Returns the new box, which may have a different type from the current one.
Panics if T2
’s size or alignment is larger than S
’s.
Sourcepub fn empty(this: Self) -> OversizedBox<(), S>
pub fn empty(this: Self) -> OversizedBox<(), S>
Empties the box, dropping the contents but preserving the allocation.
Sourcepub fn empty_pinned(this: Pin<Self>) -> OversizedBox<(), S>
pub fn empty_pinned(this: Pin<Self>) -> OversizedBox<(), S>
Empties a pinned box, dropping the contents but preserving the allocation.
Sourcepub fn into_raw(this: Self) -> (NonNull<T>, PhantomData<*mut S>)
pub fn into_raw(this: Self) -> (NonNull<T>, PhantomData<*mut S>)
Consumes this
and returns the allocation plus the phantom data
specifying the allocation type.
The phantom data is returned to make coerce!
work.
Trait Implementations§
Source§impl<T: ?Sized, S> AsMut<T> for OversizedBox<T, S>
impl<T: ?Sized, S> AsMut<T> for OversizedBox<T, S>
Source§impl<T: ?Sized, S> AsRef<T> for OversizedBox<T, S>
impl<T: ?Sized, S> AsRef<T> for OversizedBox<T, S>
Source§impl<T: ?Sized, S> Deref for OversizedBox<T, S>
impl<T: ?Sized, S> Deref for OversizedBox<T, S>
Source§impl<T: ?Sized, S> DerefMut for OversizedBox<T, S>
impl<T: ?Sized, S> DerefMut for OversizedBox<T, S>
Source§impl<T: ?Sized, S> Drop for OversizedBox<T, S>
impl<T: ?Sized, S> Drop for OversizedBox<T, S>
Source§impl<T: ?Sized, S> From<OversizedBox<T, S>> for Pin<OversizedBox<T, S>>
impl<T: ?Sized, S> From<OversizedBox<T, S>> for Pin<OversizedBox<T, S>>
Source§fn from(this: OversizedBox<T, S>) -> Self
fn from(this: OversizedBox<T, S>) -> Self
Converts to this type from the input type.
impl<T: ?Sized + Send, S> Send for OversizedBox<T, S>
impl<T: ?Sized + Sync, S> Sync for OversizedBox<T, S>
impl<T: ?Sized, S> Unpin for OversizedBox<T, S>
Auto Trait Implementations§
impl<T, S> Freeze for OversizedBox<T, S>where
T: ?Sized,
impl<T, S> RefUnwindSafe for OversizedBox<T, S>
impl<T, S> UnwindSafe for OversizedBox<T, S>
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