#tokio #async #async-std #macro-derive #async-await #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

#1634 in Asynchronous

Download history 467/week @ 2024-01-02 818/week @ 2024-01-09 689/week @ 2024-01-16 517/week @ 2024-01-23 592/week @ 2024-01-30 342/week @ 2024-02-06 634/week @ 2024-02-13 525/week @ 2024-02-20 618/week @ 2024-02-27 347/week @ 2024-03-05 712/week @ 2024-03-12 679/week @ 2024-03-19 754/week @ 2024-03-26 672/week @ 2024-04-02 460/week @ 2024-04-09 543/week @ 2024-04-16

2,552 downloads per month
Used in 5 crates (2 directly)

MIT license

26KB
517 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

~1–13MB
~141K SLoC