|
12 | 12 | //!
|
13 | 13 | //! The Rust Standard Library provides the essential runtime
|
14 | 14 | //! functionality for building portable Rust software.
|
15 |
| -//! It is linked to all Rust crates by default. |
16 | 15 | //!
|
17 |
| -//! ## Intrinsic types and operations |
| 16 | +//! It is linked to all Rust crates by default as though they |
| 17 | +//! contained a crate-level `extern crate std` crate import. Therefore |
| 18 | +//! the standard library can be accessed in `use` statements through |
| 19 | +//! the path `std`, as in `use std::thread`, or in expressions through |
| 20 | +//! the absolute path `::std`, as in `::std::thread::sleep_ms(100)`. |
18 | 21 | //!
|
19 |
| -//! The [`ptr`](ptr/index.html) and [`mem`](mem/index.html) |
20 |
| -//! modules deal with unsafe pointers and memory manipulation. |
21 |
| -//! [`marker`](marker/index.html) defines the special built-in traits, |
22 |
| -//! and [`raw`](raw/index.html) the runtime representation of Rust types. |
23 |
| -//! These are some of the lowest-level building blocks in Rust. |
| 22 | +//! Furthermore, the standard library defines [The Rust |
| 23 | +//! Prelude](prelude/index.html), a small collection of items, mostly |
| 24 | +//! traits, that are imported into and available in every module. |
24 | 25 | //!
|
25 |
| -//! ## Math on primitive types and math traits |
| 26 | +//! ## What is in the standard library |
26 | 27 | //!
|
27 |
| -//! Although basic operations on primitive types are implemented |
28 |
| -//! directly by the compiler, the standard library additionally |
29 |
| -//! defines many common operations through traits defined in |
30 |
| -//! mod [`num`](num/index.html). |
| 28 | +//! The standard library is minimal, a set of battle-tested |
| 29 | +//! core types and shared abstractions for the [broader Rust |
| 30 | +//! ecosystem][https://crates.io] to build on. |
31 | 31 | //!
|
32 |
| -//! ## Pervasive types |
| 32 | +//! The [primitive types](#primitives), though not defined in the |
| 33 | +//! standard library, are documented here, as are the predefined |
| 34 | +//! [macros](#macros). |
33 | 35 | //!
|
34 |
| -//! The [`option`](option/index.html) and [`result`](result/index.html) |
35 |
| -//! modules define optional and error-handling types, `Option` and `Result`. |
36 |
| -//! [`iter`](iter/index.html) defines Rust's iterator protocol |
37 |
| -//! along with a wide variety of iterators. |
38 |
| -//! [`Cell` and `RefCell`](cell/index.html) are for creating types that |
39 |
| -//! manage their own mutability. |
| 36 | +//! ## Containers and collections |
40 | 37 | //!
|
41 |
| -//! ## Vectors, slices and strings |
| 38 | +//! The [`option`](option/index.html) and |
| 39 | +//! [`result`](result/index.html) modules define optional and |
| 40 | +//! error-handling types, `Option` and `Result`. The |
| 41 | +//! [`iter`](iter/index.html) module defines Rust's iterator trait, |
| 42 | +//! [`Iterater`](iter/trait.Iterator.html), which works with the `for` |
| 43 | +//! loop to access collections. |
42 | 44 | //!
|
43 | 45 | //! The common container type, `Vec`, a growable vector backed by an array,
|
44 | 46 | //! lives in the [`vec`](vec/index.html) module. Contiguous, unsized regions
|
|
56 | 58 | //! macro, and for converting from strings use the
|
57 | 59 | //! [`FromStr`](str/trait.FromStr.html) trait.
|
58 | 60 | //!
|
59 |
| -//! ## Platform abstractions |
| 61 | +//! Data may be shared by placing it a reference-counted box, the |
| 62 | +//! [`Rc`][rc/index.html] type, and if further contained in a [`Cell` |
| 63 | +//! or `RefCell`](cell/index.html), may be mutated as well as shared. |
| 64 | +//! Likewise, in a concurrent setting it is common to pair an |
| 65 | +//! atomically-reference-counted box, [`Arc`](sync/struct.Arc.html), |
| 66 | +//! with a [`Mutex`](sync/struct.Mutex.html) to get the same effect. |
60 | 67 | //!
|
61 |
| -//! Besides basic data types, the standard library is largely concerned |
62 |
| -//! with abstracting over differences in common platforms, most notably |
63 |
| -//! Windows and Unix derivatives. The [`os`](os/index.html) module |
64 |
| -//! provides a number of basic functions for interacting with the |
65 |
| -//! operating environment, including program arguments, environment |
66 |
| -//! variables, and directory navigation. The [`path`](path/index.html) |
67 |
| -//! module encapsulates the platform-specific rules for dealing |
68 |
| -//! with file paths. |
69 |
| -//! |
70 |
| -//! `std` also includes the [`ffi`](ffi/index.html) module for interoperating |
71 |
| -//! with the C language. |
72 |
| -//! |
73 |
| -//! ## Concurrency, I/O, and the runtime |
| 68 | +//! The [`collections`](collections/index.html) module defines maps, |
| 69 | +//! sets, linked lists and other typical collection types, including |
| 70 | +//! the common [`HashMap`](collections/struct.HashMap.html). |
74 | 71 | //!
|
75 |
| -//! The [`thread`](thread/index.html) module contains Rust's threading abstractions. |
76 |
| -//! [`sync`](sync/index.html) contains further, primitive, shared memory types, |
77 |
| -//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpsc/index.html), |
78 |
| -//! which contains the channel types for message passing. |
| 72 | +//! ## Platform abstractions and I/O |
79 | 73 | //!
|
80 |
| -//! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets, and |
81 |
| -//! process spawning, are defined in the [`io`](io/index.html) module. |
82 |
| -//! |
83 |
| -//! Rust's I/O and concurrency depends on a small runtime interface |
84 |
| -//! that lives, along with its support code, in mod [`rt`](rt/index.html). |
85 |
| -//! While a notable part of the standard library's architecture, this |
86 |
| -//! module is not intended for public use. |
| 74 | +//! Besides basic data types, the standard library is largely concerned |
| 75 | +//! with abstracting over differences in common platforms, most notably |
| 76 | +//! Windows and Unix derivatives. |
87 | 77 | //!
|
88 |
| -//! ## The Rust prelude and macros |
| 78 | +//! Common types of I/O, including [files](fs/struct.File.html), |
| 79 | +//! [TCP](net/struct.TcpStream.html), |
| 80 | +//! [UDP](net/struct.UdpSocket.html), are defined in the |
| 81 | +//! [`io`](io/index.html), [`fs`](fs/index.html), and |
| 82 | +//! [`net`](net/index.html) modulesu. |
89 | 83 | //!
|
90 |
| -//! Finally, the [`prelude`](prelude/index.html) defines a |
91 |
| -//! common set of traits, types, and functions that are made available |
92 |
| -//! to all code by default. [`macros`](macros/index.html) contains |
93 |
| -//! all the standard macros, such as `assert!`, `panic!`, `println!`, |
94 |
| -//! and `format!`, also available to all Rust code. |
| 84 | +//! The [`thread`](thread/index.html) module contains Rust's threading |
| 85 | +//! abstractions. [`sync`](sync/index.html) contains further, |
| 86 | +//! primitive, shared memory types, including |
| 87 | +//! [`atomic`](sync/atomic/index.html), and |
| 88 | +//! [`mpsc`](sync/mpsc/index.html), which contains the channel types |
| 89 | +//! for message passing. |
| 90 | +
|
95 | 91 | // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
|
96 | 92 | #![cfg_attr(stage0, feature(custom_attribute))]
|
97 | 93 | #![crate_name = "std"]
|
|
0 commit comments