pub struct FlatDrop<K>(/* private fields */)
where
K: IntoOptionInner,
K::Inner: Recursive<Container = K>;Expand description
If K is a container of a recursive type, such as Box<T> where T: Recursive,
FlatDrop<K> behaves just like K, but with a custom Drop implementation.
In this implementation, we gather the recursive parts of the object iteratively
and drop them without recursion, avoiding stack overflows when dropping
large recursive objects.
§Safety
We keep the invariant that the inner object is always initialised, but will
be dropped (exactly once) in the drop implementation.
Implementations§
Source§impl<K> FlatDrop<K>
impl<K> FlatDrop<K>
pub const fn new(container: K) -> Self
pub fn into_inner(self) -> K
Trait Implementations§
Source§impl<K> Ord for FlatDrop<K>
impl<K> Ord for FlatDrop<K>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<K> PartialOrd for FlatDrop<K>
impl<K> PartialOrd for FlatDrop<K>
impl<K> Eq for FlatDrop<K>
impl<K> StructuralPartialEq for FlatDrop<K>
Auto Trait Implementations§
impl<K> Freeze for FlatDrop<K>where
K: Freeze,
impl<K> RefUnwindSafe for FlatDrop<K>where
K: RefUnwindSafe,
impl<K> Send for FlatDrop<K>where
K: Send,
impl<K> Sync for FlatDrop<K>where
K: Sync,
impl<K> Unpin for FlatDrop<K>where
K: Unpin,
impl<K> UnwindSafe for FlatDrop<K>where
K: 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