MCPcopy Index your code
hub / github.com/async-rs/async-std

github.com/async-rs/async-std @v1.13.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.13.2 ↗ · + Follow
950 symbols 2,119 edges 278 files 253 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

async-std has been discontinued; use smol instead

We created async-std to demonstrate the value of making a library as close to std as possible, but async. We think that demonstration was successful, and we hope it will influence future design and development directions of async in std. However, in the meantime, the smol project came about and provided a great executor and libraries for asynchronous use in the Rust ecosystem. We think that resources would be better spent consolidating around smol, rather than continuing to provide occasional maintenance of async-std. As such, we recommend that all users of async-std, and all libraries built on async-std, switch to smol instead.

In addition to the smol project as a direct replacement, you may find other parts of the futures ecosystem useful, including futures-concurrency, async-io, futures-lite, and async-compat.

API Docs | Book

This crate provides an async version of [std]. It provides all the interfaces you are used to, but in an async version and ready for Rust's async/await syntax.

Features

  • Modern: Built from the ground up for std::future and async/await with blazing fast compilation time.
  • Fast: Our robust allocator and threadpool designs provide ultra-high throughput with predictably low latency.
  • Intuitive: Complete parity with the stdlib means you only need to learn APIs once.
  • Clear: Detailed documentation and accessible guides mean using async Rust was never easier.

Examples

use async_std::task;

async fn say_hello() {
    println!("Hello, world!");
}

fn main() {
    task::block_on(say_hello())
}

More examples, including networking and file access, can be found in our [examples] directory and in our documentation.

Philosophy

We believe Async Rust should be as easy to pick up as Sync Rust. We also believe that the best API is the one you already know. And finally, we believe that providing an asynchronous counterpart to the standard library is the best way stdlib provides a reliable basis for both performance and productivity.

Async-std is the embodiment of that vision. It combines single-allocation task creation, with an adaptive lock-free executor, threadpool and network driver to create a smooth system that processes work at a high pace with low latency, using Rust's familiar stdlib API.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

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

Extension points exported contracts — how you extend this code

ToSocketAddrs (Interface)
Converts or resolves addresses to [`SocketAddr`] values. This trait is an async version of [`std::net::ToSocketAddrs`]. [11 …
src/net/addr.rs
Extend (Interface)
(no doc) [16 implementers]
src/stream/extend.rs
Context (Interface)
(no doc) [1 implementers]
src/utils.rs
IntoFuture (Interface)
(no doc) [1 implementers]
src/future/into_future.rs
BufReadExt (Interface)
(no doc) [1 implementers]
src/io/buf_read/mod.rs
FromStream (Interface)
(no doc) [21 implementers]
src/stream/from_stream.rs
FutureExt (Interface)
(no doc) [1 implementers]
src/future/future/mod.rs
SeekExt (Interface)
(no doc) [1 implementers]
src/io/seek/mod.rs

Core symbols most depended-on inside this repo

block_on
called by 111
src/task/block_on.rs
len
called by 63
src/stream/pending.rs
as_ref
called by 53
src/path/iter.rs
clone
called by 46
src/fs/file.rs
spawn_blocking
called by 44
src/task/spawn_blocking.rs
into_stream
called by 36
src/stream/into_stream.rs
get_ref
called by 35
src/io/cursor.rs
map
called by 35
src/stream/stream/mod.rs

Shape

Method 644
Function 176
Class 100
Interface 17
Enum 13

Languages

Rust100%

Modules by API surface

src/stream/stream/mod.rs57 symbols
src/path/path.rs37 symbols
src/fs/file.rs33 symbols
src/net/udp/mod.rs27 symbols
src/path/pathbuf.rs19 symbols
src/os/unix/net/datagram.rs19 symbols
src/net/tcp/stream.rs18 symbols
src/sync/condvar.rs16 symbols
src/os/unix/net/stream.rs16 symbols
src/io/cursor.rs16 symbols
tests/channel.rs15 symbols
src/sync/waker_set.rs15 symbols

For agents

$ claude mcp add async-std \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact