pub struct DropHandle<T: DropMoveTypes>(/* private fields */);
Expand description
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§
Source§impl<T: DropMoveTypes> DropHandle<T>
impl<T: DropMoveTypes> DropHandle<T>
Sourcepub fn into_inner(self_: Self) -> T
pub fn into_inner(self_: Self) -> T
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
.
Sourcepub fn into_outer(self_: Self) -> T::Outer
pub fn into_outer(self_: Self) -> T::Outer
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
.