Trait AsyncDrop

Source
pub trait AsyncDrop:
    Default
    + PartialEq
    + Eq
    + ResetDefault {
    // Provided methods
    fn async_drop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), AsyncDropError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn reset(&mut self) { ... }
    fn drop_timeout(&self) -> Duration { ... }
    fn drop_fail_action(&self) -> DropFailAction { ... }
}
Expand description

The operative trait that enables AsyncDrop functionality. Normally, implementing only async_drop(&mut self) and reset(&mut self) is necessary.

Provided Methods§

Source

fn async_drop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), AsyncDropError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Operative drop that does async operations, returning

Source

fn reset(&mut self)

A way to reset the object (set all it’s internal members to their default). This method is used after a successful AsyncDrop, to ensure that future drops do not perform async_drop behavior twice.

Source

fn drop_timeout(&self) -> Duration

Timeout for drop operation, meant to be overriden if needed

Source

fn drop_fail_action(&self) -> DropFailAction

What to do what a drop fails

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§