pub struct DropAdapter<TD: PureTryDrop>(pub TD);Expand description
A type which implements Drop for types which implements TryDrop.
§Notes
This does not implement TryDrop itself, as you could repeat calling the
TryDrop::try_drop method, potentially resulting in undefined behavior. However, it does
implement it if your type implements the RepeatableTryDrop trait.
§Implementation
We call try_drop, which is safe because we only do it in Drop::drop. If it returns an
error, we redirect the error to the fallback try drop strategy.
Tuple Fields§
§0: TDTrait Implementations§
Source§impl<TD: PureTryDrop> AsMut<TD> for DropAdapter<TD>
impl<TD: PureTryDrop> AsMut<TD> for DropAdapter<TD>
Source§impl<TD: PureTryDrop> AsRef<TD> for DropAdapter<TD>
impl<TD: PureTryDrop> AsRef<TD> for DropAdapter<TD>
Source§impl<TD: PureTryDrop> Borrow<TD> for DropAdapter<TD>
impl<TD: PureTryDrop> Borrow<TD> for DropAdapter<TD>
Source§impl<TD: PureTryDrop> BorrowMut<TD> for DropAdapter<TD>
impl<TD: PureTryDrop> BorrowMut<TD> for DropAdapter<TD>
Source§fn borrow_mut(&mut self) -> &mut TD
fn borrow_mut(&mut self) -> &mut TD
Mutably borrows from an owned value. Read more
Source§impl<TD: Clone + PureTryDrop> Clone for DropAdapter<TD>
impl<TD: Clone + PureTryDrop> Clone for DropAdapter<TD>
Source§fn clone(&self) -> DropAdapter<TD>
fn clone(&self) -> DropAdapter<TD>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<TD: Debug + PureTryDrop> Debug for DropAdapter<TD>
impl<TD: Debug + PureTryDrop> Debug for DropAdapter<TD>
Source§impl<TD: PureTryDrop> Deref for DropAdapter<TD>
impl<TD: PureTryDrop> Deref for DropAdapter<TD>
Source§impl<TD: PureTryDrop> DerefMut for DropAdapter<TD>
impl<TD: PureTryDrop> DerefMut for DropAdapter<TD>
Source§impl<TD: PureTryDrop> Drop for DropAdapter<TD>
impl<TD: PureTryDrop> Drop for DropAdapter<TD>
Source§impl<TD: PureTryDrop> From<TD> for DropAdapter<TD>
impl<TD: PureTryDrop> From<TD> for DropAdapter<TD>
Source§impl<TD: Hash + PureTryDrop> Hash for DropAdapter<TD>
impl<TD: Hash + PureTryDrop> Hash for DropAdapter<TD>
Source§impl<TD: Ord + PureTryDrop> Ord for DropAdapter<TD>
impl<TD: Ord + PureTryDrop> Ord for DropAdapter<TD>
Source§fn cmp(&self, other: &DropAdapter<TD>) -> Ordering
fn cmp(&self, other: &DropAdapter<TD>) -> Ordering
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<TD: PartialEq + PureTryDrop> PartialEq for DropAdapter<TD>
impl<TD: PartialEq + PureTryDrop> PartialEq for DropAdapter<TD>
Source§impl<TD: PartialOrd + PureTryDrop> PartialOrd for DropAdapter<TD>
impl<TD: PartialOrd + PureTryDrop> PartialOrd for DropAdapter<TD>
Source§impl<RTD: RepeatableTryDrop> PureTryDrop for DropAdapter<RTD>
impl<RTD: RepeatableTryDrop> PureTryDrop for DropAdapter<RTD>
Source§type Error = <RTD as PureTryDrop>::Error
type Error = <RTD as PureTryDrop>::Error
The type of the error that may occur during drop.
Source§type FallbackTryDropStrategy = <RTD as PureTryDrop>::FallbackTryDropStrategy
type FallbackTryDropStrategy = <RTD as PureTryDrop>::FallbackTryDropStrategy
The type which will be used if the drop strategy fails.
Source§type TryDropStrategy = <RTD as PureTryDrop>::TryDropStrategy
type TryDropStrategy = <RTD as PureTryDrop>::TryDropStrategy
The type which will be used if dropping fails.
Source§fn fallback_try_drop_strategy(&self) -> &Self::FallbackTryDropStrategy
fn fallback_try_drop_strategy(&self) -> &Self::FallbackTryDropStrategy
Get a reference to the fallback try drop strategy.
Source§fn try_drop_strategy(&self) -> &Self::TryDropStrategy
fn try_drop_strategy(&self) -> &Self::TryDropStrategy
Get a reference to the try drop strategy.
Source§unsafe fn try_drop(&mut self) -> Result<(), Self::Error>
unsafe fn try_drop(&mut self) -> Result<(), Self::Error>
Execute the fallible destructor for this type. This function is unsafe because if this is
called outside of a
Drop::drop context, once the scope of the object implementing trait
ends, this function will be called twice, potentially resulting in a double-free. Read moreSource§impl<RTD: RepeatableTryDrop> RepeatableTryDrop for DropAdapter<RTD>
impl<RTD: RepeatableTryDrop> RepeatableTryDrop for DropAdapter<RTD>
impl<TD: Eq + PureTryDrop> Eq for DropAdapter<TD>
impl<TD: PureTryDrop> StructuralPartialEq for DropAdapter<TD>
Auto Trait Implementations§
impl<TD> Freeze for DropAdapter<TD>where
TD: Freeze,
impl<TD> RefUnwindSafe for DropAdapter<TD>where
TD: RefUnwindSafe,
impl<TD> Send for DropAdapter<TD>where
TD: Send,
impl<TD> Sync for DropAdapter<TD>where
TD: Sync,
impl<TD> Unpin for DropAdapter<TD>where
TD: Unpin,
impl<TD> UnwindSafe for DropAdapter<TD>where
TD: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.