|
1 |
| -//! Async version of the Rust standard library. |
| 1 | +//! # Async version of the Rust standard library |
2 | 2 | //!
|
3 |
| -//! Modules in this crate are organized in the same way as in the standard library, except blocking |
| 3 | +//! `async-std` is a foundation of portable Rust software, a set of minimal and battle-tested |
| 4 | +//! shared abstractions for the [broader Rust ecosystem][crates.io]. It offers core types, like |
| 5 | +//! [`Future`] and [`Stream`], library-defined [operations on language primitives](#primitives), |
| 6 | +//! [standard macros](#macros), [I/O] and [multithreading], among [many other things][other]. |
| 7 | +//! |
| 8 | +//! `async-std` is available from [crates.io]. Once included, `async-std` can be accessed |
| 9 | +//! in [`use`] statements through the path `async_std`, as in [`use async_std::future`]. |
| 10 | +//! |
| 11 | +//! [I/O]: io/index.html |
| 12 | +//! [multithreading]: task/index.html |
| 13 | +//! [other]: #what-is-in-the-standard-library-documentation |
| 14 | +//! [`use`]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html |
| 15 | +//! [`use async_std::future`]: future/index.html |
| 16 | +//! [crates.io]: https://crates.io |
| 17 | +//! [`Future`]: future/trait.Future.html |
| 18 | +//! [`Stream`]: stream/trait.Stream.html |
| 19 | +//! |
| 20 | +//! # How to read this documentation |
| 21 | +//! |
| 22 | +//! If you already know the name of what you are looking for, the fastest way to |
| 23 | +//! find it is to use the <a href="#" onclick="focusSearchBar();">search |
| 24 | +//! bar</a> at the top of the page. |
| 25 | +//! |
| 26 | +//! Otherwise, you may want to jump to one of these useful sections: |
| 27 | +//! |
| 28 | +//! * [`async_std::*` modules](#modules) |
| 29 | +//! * [Async macros](#macros) |
| 30 | +//! * [The Async Prelude](prelude/index.html) |
| 31 | +//! * [Cargo.toml feature flags](#features) |
| 32 | +//! * [Examples](#examples) |
| 33 | +//! |
| 34 | +//! If this is your first time, the documentation for `async-std` is |
| 35 | +//! written to be casually perused. Clicking on interesting things should |
| 36 | +//! generally lead you to interesting places. Still, there are important bits |
| 37 | +//! you don't want to miss, so read on for a tour of the `async-std` and |
| 38 | +//! its documentation! |
| 39 | +//! |
| 40 | +//! Once you are familiar with the contents of `async-std` you may |
| 41 | +//! begin to find the verbosity of the prose distracting. At this stage in your |
| 42 | +//! development you may want to press the `[-]` button near the top of the |
| 43 | +//! page to collapse it into a more skimmable view. |
| 44 | +//! |
| 45 | +//! While you are looking at that `[-]` button also notice the `[src]` |
| 46 | +//! button. Rust's API documentation comes with the source code and you are |
| 47 | +//! encouraged to read it. The `async-std` source is generally high |
| 48 | +//! quality and a peek behind the curtains is often enlightening. |
| 49 | +//! |
| 50 | +//! Modules in this crate are organized in the same way as in `async-std`, except blocking |
4 | 51 | //! functions have been replaced with async functions and threads have been replaced with
|
5 | 52 | //! lightweight tasks.
|
6 | 53 | //!
|
7 |
| -//! More information, reading materials, and other resources: |
| 54 | +//! You can find more information, reading materials, and other resources here: |
| 55 | +//! |
| 56 | +//! * [The async-std website](https://async.rs/) |
| 57 | +//! * [The async-std book](https://book.async.rs) |
| 58 | +//! * [GitHub repository](https://github.com/async-rs/async-std) |
| 59 | +//! * [List of code examples](https://github.com/async-rs/async-std/tree/master/examples) |
| 60 | +//! * [Discord chat](https://discord.gg/JvZeVNe) |
| 61 | +//! |
| 62 | +//! # What is in the `async-std` documentation? |
| 63 | +//! |
| 64 | +//! First, `async-std` is divided into a number of focused |
| 65 | +//! modules, [all listed further down this page](#modules). These modules are |
| 66 | +//! the bedrock upon which async Rust is forged, and they have mighty names |
| 67 | +//! like [`async_std::os`] and [`async_std::task`]. Modules' documentation |
| 68 | +//! typically includes an overview of the module along with examples, and are |
| 69 | +//! a smart place to start familiarizing yourself with the library. |
| 70 | +//! |
| 71 | +//! Second, `async-std` defines [The Async Prelude], a small collection |
| 72 | +//! of items - mostly traits - that should be imported into every module of |
| 73 | +//! every async crate. The traits in the prelude are pervasive, making the |
| 74 | +//! prelude documentation a good entry point to learning about the library. |
| 75 | +//! |
| 76 | +//! [The Async Prelude]: prelude/index.html |
| 77 | +//! [`async_std::os`]: os/index.html |
| 78 | +//! [`async_std::task`]: task/index.html |
| 79 | +//! |
| 80 | +//! And finally, `async-std` exports a number of async macros, and |
| 81 | +//! [lists them on this page](#macros). |
| 82 | +//! |
| 83 | +//! # Contributing changes to the documentation |
| 84 | +//! |
| 85 | +//! Check out `async-std`'s contribution guidelines [here](https://async.rs/contribute). |
| 86 | +//! The source for this documentation can be found on [GitHub](https://github.com/async-rs). |
| 87 | +//! To contribute changes, make sure you read the guidelines first, then submit |
| 88 | +//! pull requests for your suggested changes. |
| 89 | +//! |
| 90 | +//! Contributions are appreciated! If you see a part of the docs that can be |
| 91 | +//! improved, submit a PR, or chat with us first on |
| 92 | +//! [Discord](https://discord.gg/JvZeVNe). |
| 93 | +//! |
| 94 | +//! # A tour of `async-std` |
| 95 | +//! |
| 96 | +//! The rest of this crate documentation is dedicated to pointing out notable |
| 97 | +//! features of `async-std`. |
| 98 | +//! |
| 99 | +//! ## Platform abstractions and I/O |
| 100 | +//! |
| 101 | +//! Besides basic data types, `async-std` is largely concerned with |
| 102 | +//! abstracting over differences in common platforms, most notably Windows and |
| 103 | +//! Unix derivatives. |
| 104 | +//! |
| 105 | +//! Common types of I/O, including [files], [TCP], [UDP], are defined in the |
| 106 | +//! [`io`], [`fs`], and [`net`] modules. |
| 107 | +//! |
| 108 | +//! The [`task`] module contains `async-std`'s task abstractions. [`sync`] |
| 109 | +//! contains further primitive shared memory types, including [`channel`], |
| 110 | +//! which contains the channel types for message passing. |
| 111 | +//! |
| 112 | +//! [files]: fs/struct.File.html |
| 113 | +//! [TCP]: net/struct.TcpStream.html |
| 114 | +//! [UDP]: net/struct.UdpSocket.html |
| 115 | +//! [`io`]: fs/struct.File.html |
| 116 | +//! [`sync`]: sync/index.html |
| 117 | +//! [`channel`]: sync/fn.channel.html |
| 118 | +//! |
| 119 | +//! ## Timeouts, intervals, and delays |
| 120 | +//! |
| 121 | +//! `async-std` provides several methods to manipulate time: |
| 122 | +//! |
| 123 | +//! * [`task::sleep`] to wait for a duration to pass without blocking. |
| 124 | +//! * [`stream::interval`] for emitting an event at a set interval. |
| 125 | +//! * [`future::timeout`] to time-out futures if they don't resolve within a |
| 126 | +//! set interval. |
8 | 127 | //!
|
9 |
| -//! * [π The async-std website](https://async.rs/) |
10 |
| -//! * [π The async-std book](https://book.async.rs) |
11 |
| -//! * [π GitHub repository](https://github.com/async-rs/async-std) |
12 |
| -//! * [π List of code examples](https://github.com/async-rs/async-std/tree/master/examples) |
13 |
| -//! * [π¬ Discord chat](https://discord.gg/JvZeVNe) |
| 128 | +//! [`task::sleep`]: task/fn.sleep.html |
| 129 | +//! [`stream::interval`]: stream/fn.interval.html |
| 130 | +//! [`future::timeout`]: future/fn.timeout.html |
14 | 131 | //!
|
15 | 132 | //! # Examples
|
16 | 133 | //!
|
|
0 commit comments