Skip to main content

AsyncDrop

Trait AsyncDrop 

Source
pub trait AsyncDrop {
    // Required method
    fn async_drop(&mut self) -> AsyncDropFuture<'_>;
}
Expand description

A trait for types that require asynchronous cleanup.

Implement this trait to define async teardown logic (e.g. flushing buffers, closing network connections, or releasing distributed locks). Use Dropper to ensure async_drop is called automatically when the value goes out of scope.

Required Methods§

Source

fn async_drop(&mut self) -> AsyncDropFuture<'_>

Performs asynchronous cleanup of this value.

Returns Ok(()) on success or Err with a message that will be printed to stderr.

Implementors§