What problem does it solve?
AsyncDrop patterns enforce safe, asynchronous cleanup for resources in Rust, addressing the need to properly finalize resources that require async teardown, preventing leaks and ensuring deterministic shutdown.
Core Features & Use Cases
- AsyncDropGuard wraps values to require explicit asynchronous cleanup via async_drop().
- AsyncDrop trait implementations provide per-resource cleanup logic.
- Patterns for composition and ownership: delegating to member AsyncDrops, with_async_drop_2 macro, and sharing via AsyncDropArc.
- Concurrency-friendly cleanup, including parallel drops for independent members and safe transfer of guard ownership.
Quick Start
Use the AsyncDrop pattern to ensure a resource is cleaned up asynchronously by wrapping it in AsyncDropGuard and invoking async_drop() when done.