[][src]Struct high_mem_utils::DontDrop

#[repr(transparent)]
pub struct DontDrop<T: Default>(pub T);

A wrapper for an implementation of drop that mem::take the value and [mem::forget]s it.

This might be useful if you want assuring that a particular destructor not run if it can lead to a double-free or another memory issue.

This type is particularly not recomended for reference types because as such they can never be null and the value is still dropped. Neither on types with a costly initialization because it replaces the forgotten value with the Default one,these values should not implement it anyways.

This type has the same implications that forget except for the fact that this ensures that the value is never dropped even on panic,unless you abort.In general DontDropOpt is preferred.

It derefs to T.

Methods

impl<T: Default> DontDrop<T>[src]

pub fn into_inner(&mut self) -> T[src]

Returns the field,allowing it to be dropped again.

Trait Implementations

impl<T: Default> Deref for DontDrop<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: Default> DerefMut for DontDrop<T>[src]

impl<T: Default> Drop for DontDrop<T>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.