Struct dispose::Disposable
source · pub struct Disposable<T: Dispose>(_);
Expand description
Implementations§
source§impl<T: Dispose> Disposable<T>
impl<T: Dispose> Disposable<T>
sourcepub unsafe fn leak(this: Self) -> T
pub unsafe fn leak(this: Self) -> T
Consume the wrapper, producing the contained value.
Safety
It is up to the user to ensure the value does not fall out of scope without being consumed.
The value can be safely re-inserted into a Disposable
using
Disposable::new
to restore safe drop behavior, and it is
recommended that the value is held by some container which
consumes it on drop at all times. The intended use case for this
function is transferring the value from one container to the other.
Trait Implementations§
source§impl<T: Dispose> AsMut<T> for Disposable<T>
impl<T: Dispose> AsMut<T> for Disposable<T>
source§impl<T: Dispose> AsRef<T> for Disposable<T>
impl<T: Dispose> AsRef<T> for Disposable<T>
source§impl<T: Dispose> Borrow<T> for Disposable<T>
impl<T: Dispose> Borrow<T> for Disposable<T>
source§impl<T: Dispose> BorrowMut<T> for Disposable<T>
impl<T: Dispose> BorrowMut<T> for Disposable<T>
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T: Dispose> Deref for Disposable<T>
impl<T: Dispose> Deref for Disposable<T>
source§impl<T: Dispose> DerefMut for Disposable<T>
impl<T: Dispose> DerefMut for Disposable<T>
source§impl<T: Dispose> Drop for Disposable<T>
impl<T: Dispose> Drop for Disposable<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Disposable<T>where T: RefUnwindSafe,
impl<T> Send for Disposable<T>where T: Send,
impl<T> Sync for Disposable<T>where T: Sync,
impl<T> Unpin for Disposable<T>where T: Unpin,
impl<T> UnwindSafe for Disposable<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