Module std
The Rust standard library
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 pointers and references (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
).
Standard library injection and the Rust prelude
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::*;
Modules
any | Traits for dynamic typing of any type (through runtime reflection) |
ascii | Operations on ASCII strings and characters |
at_vec | Operations on managed vectors ( |
bool | Operations on boolean values ( |
borrow | Utilities for references |
c_str | C-string manipulation and management |
cast | Unsafe casting functions |
cell | Types dealing with dynamic mutability |
char | Unicode characters manipulation ( |
clone | The |
cmath | Bindings for the C math library (for basic mathematic functions) |
cmp | The |
comm | Communication primitives for concurrent tasks ( |
condition | Condition handling |
container | Traits for generic containers (including |
default | The |
f32 | Operations and constants for 32-bits floats ( |
f64 | Operations and constants for 64-bits floats ( |
fmt | Utilities for formatting and printing strings |
from_str | The |
gc | Task-local garbage-collected boxes |
hash | Implementation of SipHash 2-4 |
hashmap | Unordered containers, implemented as hash-tables ( |
i16 | Operations and constants for signed 16-bits integers ( |
i32 | Operations and constants for signed 32-bits integers ( |
i64 | Operations and constants for signed 64-bits integers ( |
i8 | Operations and constants for signed 8-bits integers ( |
int | Operations and constants for architecture-sized signed integers ( |
io | Synchronous I/O |
iter | Composable external iterators |
kinds | Primitive traits representing basic 'kinds' of types |
libc | Bindings for the C standard library and other platform libraries |
local_data | Task local data management |
logging | Utilities for program-wide and customizable logging |
managed | Operations on managed box types |
mem | Functions relating to memory layout |
num | Numeric traits and functions for generic mathematics |
ops | Traits representing built-in operators, useful for overloading |
option | Optionally nullable values ( |
os | Higher-level interfaces to libc::* functions and operating system services. |
path | Cross-platform path support |
prelude | The standard module imported by default into all Rust modules |
ptr | Unsafe pointer utility functions |
rand | Utilities for random number generation |
rc | Task-local reference-counted boxes ( |
reflect | Runtime type reflection |
repr | More runtime type reflection |
result | Signaling success or failure states ( |
rt | Runtime services, including the task scheduler and I/O dispatcher |
run | Utilities for spawning and managing processes |
send_str | The |
str | Unicode string manipulation ( |
sync | Useful synchronization primitives |
task | Utilities for managing and scheduling tasks |
to_bytes | The |
to_str | The |
trie | Ordered containers with integer keys, implemented as radix tries ( |
tuple | Operations on tuples |
u16 | Operations and constants for unsigned 16-bits integers ( |
u32 | Operations and constants for unsigned 32-bits integers ( |
u64 | Operations and constants for unsigned 64-bits integer ( |
u8 | Operations and constants for unsigned 8-bits integers ( |
uint | Operations and constants for architecture-sized unsigned integers ( |
util | Miscellaneous helpers for common patterns |
vec | Utilities for vector manipulation |