smol

适用于 Rust 的小型快速异步运行时。「A small and fast async runtime for Rust」

Github星跟踪图

smol

Build
License
Cargo
Documentation
Chat

A small and fast async runtime for Rust.

This runtime extends the standard library with async combinators
and is only 1500 lines of code long.

Reading the docs or looking at the examples is a great way to start learning
async Rust.

Async I/O is implemented using epoll on Linux/Android, kqueue on
macOS/iOS/BSD, and wepoll on Windows.

What makes smol different from async-std and tokio?
Read this blog post.

Features

  • Async TCP, UDP, Unix domain sockets, and custom file descriptors.
  • Thread-local executor for !Send futures.
  • Work-stealing executor that adapts to uneven workloads.
  • Blocking executor for files, processes, and standard I/O.
  • Tasks that support cancellation.
  • Userspace timers.

Examples

You need to be in the examples directory to run them:

$ cd examples
$ ls
$ cargo run --example ctrl-c

Compatibility

See this example for how to use smol with
async-std, tokio, surf, and reqwest.

There is an optional feature for seamless integration with crates depending
on tokio. It creates a global tokio runtime and sets up its context inside smol.
Enable the feature as follows:

[dependencies]
smol = { version = "0.1", features = ["tokio02"] }

Documentation

You can read the docs here, or generate them on your own.

If you'd like to explore the implementation in more depth, the following
command generates docs for the whole crate, including private modules:

cargo doc --document-private-items --no-deps --open

Other crates

My personal crate recommendation list:

TLS certificate

Some code examples are using TLS for authentication. The repository
contains a self-signed certificate usable for testing, but it should not
be used for real-world scenarios. Browsers and tools like curl will
show this certificate as insecure.

In browsers, accept the security prompt or use curl -k on the
command line to bypass security warnings.

The certificate file was generated using
minica and
openssl:

minica --domains localhost -ip-addresses 127.0.0.1 -ca-cert certificate.pem
openssl pkcs12 -export -out identity.pfx -inkey localhost/key.pem -in localhost/cert.pem

License

Licensed under either of

at your option.

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.

主要指标

概览
名称与所有者epoberezkin/fast-deep-equal
主编程语言JavaScript
编程语言Rust (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2017-06-15 22:23:23
推送于2023-10-05 21:22:34
最后一次提交2020-06-09 09:59:48
发布数14
最新版本名称v3.1.3 (发布于 2020-06-08 08:25:12)
第一版名称v0.1.0 (发布于 2017-06-16 22:55:08)
用户参与
星数1.9k
关注者数14
派生数101
提交数123
已启用问题?
问题数53
打开的问题数19
拉请求数22
打开的拉请求数14
关闭的拉请求数57
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?