|
8 | 8 | // option. This file may not be copied, modified, or distributed
|
9 | 9 | // except according to those terms.
|
10 | 10 |
|
11 |
| -//! # The Rust standard library |
| 11 | +//! # The Rust Standard Library |
12 | 12 | //!
|
13 |
| -//! The Rust standard library is a group of interrelated modules defining |
14 |
| -//! the core language traits, operations on built-in data types, |
15 |
| -//! platform abstractions, the task scheduler, runtime support for language |
16 |
| -//! features and other common functionality. |
| 13 | +//! The Rust Standard Library provides the essential runtime |
| 14 | +//! functionality for building portable Rust software. |
| 15 | +//! It is linked to all Rust crates by default. |
17 | 16 | //!
|
18 |
| -//! `std` includes modules corresponding to each of the integer types, |
19 |
| -//! each of the floating point types, the `bool` type, tuples, characters, |
20 |
| -//! strings (`str`), vectors (`vec`), managed boxes (`managed`), owned |
21 |
| -//! boxes (`owned`), and unsafe pointers and references (`ptr`, `borrowed`). |
22 |
| -//! Additionally, `std` provides pervasive types (`option` and `result`), |
23 |
| -//! task creation and communication primitives (`task`, `comm`), platform |
24 |
| -//! abstractions (`os` and `path`), basic I/O abstractions (`io`), common |
25 |
| -//! traits (`kinds`, `ops`, `cmp`, `num`, `to_str`), and complete bindings |
26 |
| -//! to the C standard library (`libc`). |
| 17 | +//! ## Intrinsic types and operations |
27 | 18 | //!
|
28 |
| -//! # Standard library injection and the Rust prelude |
| 19 | +//! The [`ptr`](ptr/index.html), [`mem`](mem/index.html), |
| 20 | +//! and [`cast`](cast/index.html) modules deal with unsafe pointers, |
| 21 | +//! memory manipulation, and coercion. |
| 22 | +//! [`kinds`](kinds/index.html) defines the special built-in traits, |
| 23 | +//! and [`raw`](raw/index.html) the runtime representation of Rust types. |
| 24 | +//! These are some of the lowest-level building blocks of Rust |
| 25 | +//! abstractions. |
29 | 26 | //!
|
30 |
| -//! `std` is imported at the topmost level of every crate by default, as |
31 |
| -//! if the first line of each crate was |
| 27 | +//! ## Math on primitive types and math traits |
32 | 28 | //!
|
33 |
| -//! extern crate std; |
| 29 | +//! Although basic operations on primitive types are implemented |
| 30 | +//! directly by the compiler, the standard library additionally |
| 31 | +//! defines many common operations through traits defined in |
| 32 | +//! mod [`num`](num/index.html). |
34 | 33 | //!
|
35 |
| -//! This means that the contents of std can be accessed from any context |
36 |
| -//! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`, |
37 |
| -//! etc. |
| 34 | +//! ## Pervasive types |
38 | 35 | //!
|
39 |
| -//! Additionally, `std` contains a `prelude` module that reexports many of the |
40 |
| -//! most common types, traits and functions. The contents of the prelude are |
41 |
| -//! imported into every *module* by default. Implicitly, all modules behave as if |
42 |
| -//! they contained the following prologue: |
| 36 | +//! The [`option`](option/index.html) and [`result`](result/index.html) |
| 37 | +//! modules define optional and error-handling types, `Option` and `Result`. |
| 38 | +//! [`iter`](iter/index.html) defines Rust's iterator protocol |
| 39 | +//! along with a wide variety of iterators. |
| 40 | +//! [`Cell` and `RefCell`](cell/index.html) are for creating types that |
| 41 | +//! manage their own mutability. |
43 | 42 | //!
|
44 |
| -//! use std::prelude::*; |
| 43 | +//! ## Vectors, slices and strings |
| 44 | +//! |
| 45 | +//! The common container type, `Vec`, a growable vector backed by an |
| 46 | +//! array, lives in the [`vec`](vec/index.html) module. References to |
| 47 | +//! arrays, `&[T]`, more commonly called "slices", are built-in types |
| 48 | +//! for which the [`slice`](slice/index.html) module defines many |
| 49 | +//! methods. |
| 50 | +//! |
| 51 | +//! UTF-8 strings, `~str` and `&str`, are built-in types, and the |
| 52 | +//! standard library defines methods for them on a variety of traits |
| 53 | +//! in the [`str`](str/index.html) module. Rust strings are immutable; |
| 54 | +//! use the `StrBuf` type defined in [`strbuf`](strbuf/index.html) |
| 55 | +//! for a mutable string builder. |
| 56 | +//! |
| 57 | +//! For converting to strings use the [`format!`](fmt/index.html) |
| 58 | +//! macro, and for converting from strings use the |
| 59 | +//! [`FromStr`](from_str/index.html) trait. |
| 60 | +//! |
| 61 | +//! ## Platform abstractions |
| 62 | +//! |
| 63 | +//! Besides basic data types, the standard library is largely concerned |
| 64 | +//! with abstracting over differences in common platforms, most notably |
| 65 | +//! Windows and Unix derivatives. The [`os`](os/index.html) module |
| 66 | +//! provides a number of basic functions for interacting with the |
| 67 | +//! operating environment, including program arguments, environment |
| 68 | +//! variables, and directory navigation. The [`path`](path/index.html) |
| 69 | +//! module encapsulates the platform-specific rules for dealing |
| 70 | +//! with file paths. |
| 71 | +//! |
| 72 | +//! `std` also includes modules for interoperating with the |
| 73 | +//! C language: [`c_str`](c_str/index.html) and |
| 74 | +//! [`c_vec`](c_vec/index.html). |
| 75 | +//! |
| 76 | +//! ## Concurrency, I/O, and the runtime |
| 77 | +//! |
| 78 | +//! The [`task`](task/index.html) module contains Rust's threading abstractions, |
| 79 | +//! while [`comm`](comm/index.html) contains the channel types for message |
| 80 | +//! passing. [`sync`](sync/index.html) contains further, primitive, shared |
| 81 | +//! memory types, including [`atomics`](sync/atomics/index.html). |
| 82 | +//! |
| 83 | +//! Common types of I/O, including files, TCP, UPD, pipes, Unix domain sockets, |
| 84 | +//! timers, and process spawning, are defined in the [`io`](io/index.html). |
| 85 | +//! |
| 86 | +//! Rust's I/O and concurrency depends on a small runtime interface |
| 87 | +//! that lives, along with its support code, in mod [`rt`](rt/index.html). |
| 88 | +//! While a notable part of the standard library's architecture, this |
| 89 | +//! module is not intended for public use. |
| 90 | +//! |
| 91 | +//! ## The Rust prelude and macros |
| 92 | +//! |
| 93 | +//! Finally, the [`prelude`](prelude/index.html) defines a set of |
| 94 | +//! common set of traits, types, and functions that are made available |
| 95 | +//! to all code by default. [`macros`](macros/index.html) contains |
| 96 | +//! all the standard macros, such as `assert!`, `fail!`, `println!`. |
45 | 97 |
|
46 | 98 | #![crate_id = "std#0.11-pre"]
|
47 | 99 | #![comment = "The Rust standard library"]
|
|
0 commit comments