smol-rs / futures-lite

Futures, streams, and async I/O combinators.
Apache License 2.0
427 stars 25 forks source link

Add a way to provide your own seed to racey futures #75

Closed notgull closed 10 months ago

notgull commented 11 months ago

The race functions were not available on no_std targets. This commit adds "with_seed" variants that take a u64 seed that is passed to fastrand. It can be used on no_std targets to provide random racey futures and streams.

A "race" feature is added that enables it. This way fastrand doesn't become a dependency for crates that don't need it, like async-io.

As part of this change, each racy futures provides its own Rng instance.