⚠️ Deprecation notice ⚠️

Runtime is no longer actively developed. The team behind Runtime has moved on to
building async-std: an asynchronous version of the Rust
stdlib.

If you're looking for an asynchronous runtime please consider using
async-std or tokio.

About

Runtime is what we imagine async APIs could look like if they were part of stdlib. We want async
Rust to be an experience that mirrors the quality of the standard lib. We believe that in order for
Rust to succeed it's not only important to make async Rust possible, it's crucial to make async
Rust feel seamless.

And the embodiment of these values is Runtime: a library crafted to empower everyone to build
asynchronous software.

runtime agnostic: Runtime comes with minimal OS bindings out of the box, but switching to a
different runtime is a matter of changing a single line.

Attributes

Runtime introduces 3 attributes to enable the use of await anywhere, and swap between different
runtimes. Each Runtime is bound locally to the initializing thread. This enables the testing of
different runtimes during testing or benchmarking.

Installation

To use Futures in the same project, make sure to install
futures-preview for std futures.

$ cargo add futures-preview --allow-prerelease

futures-preview provides support for std futures/futures 0.3, while futures provides support for
the no longer developed futures 0.1. Once futures land in stdlib, it's expected that the two crates
will merge back into futures. With the hopes that eventually most of futures will be part of
stdlib.

FAQ

When is it useful to switch Runtimes?

What might be the best solution now, might not stay the best in the future. As Rust grows, so will
the ecosystem. By making runtimes pluggable, your code can be forward compatible with any future
changes. And as things evolve, you'll be able to test out the benefit new developments in the
ecosystem have on your code by just changing a single line.

How is Runtime versioned?

We're currently in the 0.3-alpha range of releases, mirroring the Futures libraries. Once
Futures hits 1.0, we'll follow suit and move over to semver proper.

This doesn't mean that Runtime won't release breaking changes. But if we do, we'll release a new
major version, and provide instructions on how to upgrade. We view Runtime to be a foundational
piece of technology, and that means we have to be serious about our stability guarantees.

Can I use Runtime in production?

Runtime is a thin layer that sits between your code and the backing runtimes. If you trust the
backing runtime in production, then you can probably trust Runtime too.

Why is Runtime Native the default?

We believe Runtime Native provides a balanced implementation that works well for most scenarios. The
codebase is small and comprehensive, and the algorithms simple yet performant.

Specific runtimes might introduce different trade-offs, and with Runtime you're able to compare, and
pick the best fit for your requirements.

Can Runtime be used on embedded devices?

Runtime is designed to be compatible with micro processors, but not with micro controllers. Out of
the box Runtime works on embedded devices such as Raspberry Pis, and with the appropriate backends
it should also work on phones.

Micro controllers are very specific in what they provide, and while a Runtime-like library might be
possible in the future, it's still early for the ecosystem and APIs would likely also need to be
different. We don't know what the future holds, but for now we've chosen not to target micro
controllers.

When will Timers and File System support land?

Timers are next up on the list of things we want to target, together with Unix Domain Sockets.
Filesystem is a bit further behind because currently the implementations in the backing runtimes are
changing, and we're not sure yet how to best abstract that.

Getting things right takes time. But if you'd like to move the state of async forward, we'd love for
you to get involved!

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

License

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.