logoalt Hacker News

12_throw_awayyesterday at 8:27 PM0 repliesview on HN

> > And pretty much everything in rust async is put into an Arc.

> IIRC that's more a tokio thing than a Rust async thing in general. Parts of the ecosystem that use a different runtime (e.g., IIRC embassy in embedded) don't face the same requirements.

Well, if you're implementing an async rust executor, the current async system gives you exactly 2 choices:

1) Implement the `Wake` trait, which requires `Arc` [1], or

2) Create your own `RawWaker` and `RawWakerVTable` instances, which are gobsmackingly unsafe, including `void*` pointers and DIY vtables [2]

[1] https://doc.rust-lang.org/std/task/trait.Wake.html

[2] https://doc.rust-lang.org/std/task/struct.RawWaker.html