#tokio #async #async-std #async-await #macro-derive #default #async-drop

async-dropper-simple

A simple struct-wrapper (i.e. AsyncDropper<T>) based implementation of AsyncDrop

12 releases

0.2.6 Jan 31, 2024
0.2.5 Oct 20, 2023
0.2.3 Aug 9, 2023
0.1.4 Jul 30, 2023

#1285 in Asynchronous

Download history 961/week @ 2024-07-21 1190/week @ 2024-07-28 989/week @ 2024-08-04 1243/week @ 2024-08-11 1100/week @ 2024-08-18 1296/week @ 2024-08-25 1353/week @ 2024-09-01 953/week @ 2024-09-08 619/week @ 2024-09-15 598/week @ 2024-09-22 583/week @ 2024-09-29 842/week @ 2024-10-06 639/week @ 2024-10-13 840/week @ 2024-10-20 756/week @ 2024-10-27 719/week @ 2024-11-03

3,018 downloads per month
Used in 7 crates (2 directly)

MIT license

28KB
552 lines

🗑 async-dropper-simple

async-dropper is probably the least-worst ad-hoc AsyncDrop implementation you've seen, and it works in two ways:

  • async_dropper::simple is stolen nearly verbatim from this StackOverflow answer (thanks to paholg!)
  • async_dropper::derive provides a trait called AsyncDrop and corresponding [derive macro][rust-derive-macro], which try to use Default and PartialEq to determine when to async drop.

The code in this crate powers async_dropper::simple. See the async_dropper crate for more details.

Feature flags

Flag Description
tokio Use the [tokio][tokio] async runtime
async-std use the [async-std][async-std] async runtime
no-default-bound Avoid the Default bound on your T by wrapping the interior data in an Option<T>

Dependencies

~0.9–11MB
~137K SLoC