pub struct DontDrop<T>(/* private fields */);Expand description
A wrapper that guarentees that the dropper of the underlying object cannot be safely called.
Implementations§
Source§impl<T> DontDrop<T>
impl<T> DontDrop<T>
pub const fn new(value: T) -> Self
Sourcepub const unsafe fn into_inner(self) -> T
pub const unsafe fn into_inner(self) -> T
Gets the underlying value.
§Safety
At least one of the following must be upheld
- The inner value cannot be dropped
- The circumstances outlined in the safety section of DontDrop::drop
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for DontDrop<T>where
T: Freeze,
impl<T> RefUnwindSafe for DontDrop<T>where
T: RefUnwindSafe,
impl<T> Send for DontDrop<T>where
T: Send,
impl<T> Sync for DontDrop<T>where
T: Sync,
impl<T> Unpin for DontDrop<T>where
T: Unpin,
impl<T> UnwindSafe for DontDrop<T>where
T: 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