smol-rs / smol

A small and fast async runtime for Rust
Apache License 2.0
3.66k stars 155 forks source link

Equivalent of `tokio::sync::watch` #311

Open joshtriplett opened 3 months ago

joshtriplett commented 3 months ago

I'd love to have an equivalent of the tokio::sync::watch types. These provide a channel that stores only the latest value sent. This is convenient for request coalescing: first one in creates the watch and spawns a task to do the request, subsequent requests wait on the existing watch.

notgull commented 3 months ago

Yes, this would be a nice addition. It would probably be a separate crate.

notgull commented 3 months ago

There is async-watch, which is based on tokio's implementation and built on event-listener. But it hasn't been updated for several years.

Poke @cynecx