[][src]Struct drop_move::DropHandle

pub struct DropHandle<T: DropMoveTypes>(_);

A wrapper of T::Outer that will drop by converting to T then dropping, rather than dropping the T::Outer.

The trouble with making drop be pass by move is that the self parameter may end up being dropped, creating infinite recursion. To avoid this, a DropHandle is passed to drop_move so that if it goes out of scope it will not create infinite recursion. This implements Deref and DerefMut for easy access to functions on T::Outer.

Implementations

impl<T: DropMoveTypes> DropHandle<T>[src]

pub fn into_inner(self_: Self) -> T[src]

Convert to the inner structure T.

This is an associated function so that will not conflict with any methods of T::Outer, which are accessible through Deref.

pub fn into_outer(self_: Self) -> T::Outer[src]

Convert to the outer structure T::Outer. Be careful when using this function, as it is easy to end up recursively calling drop on the output by accident, creating an infinite recursive loop.

This is an associated function so that will not conflict with any methods of T::Outer, which are accessible through Deref.

Trait Implementations

impl<T: Debug + DropMoveTypes> Debug for DropHandle<T> where
    T::Outer: Debug
[src]

impl<T: DropMoveTypes> Deref for DropHandle<T>[src]

type Target = T::Outer

The resulting type after dereferencing.

impl<T: DropMoveTypes> DerefMut for DropHandle<T>[src]

impl<T: DropMoveTypes> Drop for DropHandle<T>[src]

impl<T: DropMoveTypes> From<T> for DropHandle<T>[src]

Auto Trait Implementations

impl<T> Send for DropHandle<T> where
    <T as DropMoveTypes>::Outer: Send
[src]

impl<T> Sync for DropHandle<T> where
    <T as DropMoveTypes>::Outer: Sync
[src]

impl<T> Unpin for DropHandle<T> where
    <T as DropMoveTypes>::Outer: Unpin
[src]

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<!> for T[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.