smol-rs/smol

Rust

A small and fast async runtime for Rust

rustasyncnetworkingconcurrencyfuturesruntime
Star 增长趋势
Star
5.1k
Forks
196
周增长
+3
Issues
19
2k4k
2023年1月2024年3月2025年6月2026年9月
制品库crates.io
README

smol

Build License Cargo Documentation Chat

kitty

A small and fast async runtime.

This crate simply re-exports other smaller async crates (see the source).

To use tokio-based libraries with smol, apply the async-compat adapter to futures and I/O types.

See the smol-macros crate if you want a no proc-macro, fast compiling, easy-to-use async main and/or multi-threaded Executor setup out of the box.

Examples

Connect to an HTTP website, make a GET request, and pipe the response to the standard output:

use smol::{io, net, prelude::*, Unblock};

fn main() -> io::Result<()> {
    smol::block_on(async {
        let mut stream = net::TcpStream::connect("example.com:80").await?;
        let req = b"GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n";
        stream.write_all(req).await?;

        let mut stdout = Unblock::new(std::io::stdout());
        io::copy(stream, &mut stdout).await?;
        Ok(())
    })
}

There's a lot more in the examples directory.

Subcrates

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

Another useful tool for making certificates is mkcert.

MSRV Policy

The Minimum Supported Rust Version (MSRV) of this crate is 1.85. As a tentative policy, the MSRV will not advance past the current Rust version provided by Debian Stable. At the time of writing, this version of Rust is 1.85. However, the MSRV may be advanced further in the event of a major ecosystem shift or a security vulnerability.

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.

相关仓库
farion1231/cc-switch

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

Rustcrates.ioskillMIT Licenseai-toolsclaude-code
ccswitch.io
131.8k9.1k
rustdesk/rustdesk

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Rustcrates.ioappGNU Affero General Public License v3.0remote-controlremote-desktop
rustdesk.com
123k18.9k
rust-lang/rust

Empowering everyone to build reliable and efficient software.

Rustcrates.ioApache License 2.0rustcompiler
rust-lang.org
118k15.5k
tauri-apps/tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Rustcrates.iolibraryApache License 2.0rustwebview
tauri.app
110.9k3.9k
denoland/deno

A modern runtime for JavaScript and TypeScript.

Rustcrates.ioMIT Licensedenotypescript
deno.com
108.4k6.4k
oven-sh/bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

Rustcrates.iolibraryOtherbunbundler
bun.com
95.9k5k
rtk-ai/rtk

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Rustcrates.iocliApache License 2.0agentic-codingai-coding
rtk-ai.app
79.6k5k
unionlabs/union

The trust-minimized, zero-knowledge bridging protocol, designed for censorship resistance, extremely high security, and usage in decentralized finance.

Rustcrates.ioApache License 2.0blockchaincosmos
union.build
73.8k3.9k
toeverything/AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

TypeScriptnpmappOthereditorcrdt
affine.pro
72.4k5.3k
openinterpreter/openinterpreter

A coding agent for open models like Kimi K3 and GLM 5.3

Rustcrates.ioApache License 2.0coding-agentdeepseek
openinterpreter.com
68.3k5.9k
BurntSushi/ripgrep

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Rustcrates.iocliThe Unlicenseripgreprecursively-search
68.1k2.8k
dani-garcia/vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs

Rustcrates.ioGNU Affero General Public License v3.0vaultwardenbitwarden
67k3.2k