The Rust standard library is a group of interrelated modules defining the core language traits, operations on built-in data types, collections, platform abstractions, the task scheduler, runtime support for language features and other common functionality.
std
includes modules corresponding to each of the integer types,
each of the floating point types, the bool
type, tuples, characters,
strings (str
), vectors (vec
), managed boxes (managed
), owned
boxes (owned
), and unsafe and borrowed pointers (ptr
, borrowed
).
Additionally, std
provides pervasive types (option
and result
),
task creation and communication primitives (task
, comm
), platform
abstractions (os
and path
), basic I/O abstractions (io
), common
traits (kinds
, ops
, cmp
, num
, to_str
), and complete bindings
to the C standard library (libc
).
std
is imported at the topmost level of every crate by default, as
if the first line of each crate was
extern mod std;
This means that the contents of std can be accessed from any context
with the std::
path prefix, as in use std::vec
, use std::task::spawn
,
etc.
Additionally, std
contains a prelude
module that reexports many of the
most common types, traits and functions. The contents of the prelude are
imported into every module by default. Implicitly, all modules behave as if
they contained the following prologue:
use std::prelude::*;
ascii | Operations on ASCII strings and characters. |
at_vec | Managed vectors |
bool | The |
borrow | Borrowed pointer utilities |
c_str | C-string manipulation and management |
cast | Unsafe casting functions |
cell | A mutable, nullable memory location |
char | Utilities for manipulating the char type |
clone | The Clone trait for types that cannot be "implicitly copied" |
cmath | |
cmp | The |
comm | Message passing |
condition | Condition handling |
container | Container traits |
default | The Default trait |
either | A type that represents one of two alternatives |
f32 | Operations and constants for |
f64 | Operations and constants for |
float | Operations and constants for |
fmt | The Formatting Module |
from_str | The trait for types that can be created from strings |
hash | Implementation of SipHash 2-4 |
hashmap | An unordered map and set type implemented as hash tables |
i16 | Operations and constants for |
i32 | Operations and constants for |
i64 | Operations and constants for |
i8 | Operations and constants for |
int | Operations and constants for |
io | The |
iter | Composable external iterators |
kinds | The kind traits |
libc | Bindings for the C standard library and other platform libraries |
local_data | Task local data management |
logging | Logging |
managed | Operations on managed box types |
num | Numeric traits and functions for generic mathematics. |
ops | Traits for the built-in operators |
option | Operations on the ubiquitous |
os | Higher-level interfaces to libc::* functions and operating system services. |
owned | Operations on unique pointer types |
path | Cross-platform file path handling |
prelude | Many programming languages have a 'prelude': a particular subset of the libraries that come with the language. Every program imports the prelude by default. |
ptr | Unsafe pointer utility functions |
rand | Random number generation. |
reflect | Runtime type reflection |
repr | More runtime type reflection |
result | A type representing either success or failure |
routine | Routines are like closures except that they own their arguments and can only run once. |
rt | The Rust Runtime, including the task scheduler and I/O |
run | Process spawning. |
select | |
send_str |
|
str | String manipulation |
sys | Misc low level stuff |
task | Task management. |
to_bytes | The |
to_str | The |
trie | An ordered map and set for integer keys implemented as a radix trie |
tuple | Operations on tuples |
u16 | Operations and constants for |
u32 | Operations and constants for |
u64 | Operations and constants for |
u8 | Operations and constants for |
uint | Operations and constants for |
unicode | |
unit | Functions for the unit type. |
util | Miscellaneous helpers for common patterns. |
vec | Vector manipulation |
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).