Crate 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, 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 crate 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 |
bool | Operations on boolean values ( |
c_str | C-string manipulation and management |
c_vec | Library to interface with chunks of memory allocated in C. |
cast | Unsafe casting functions |
cell | Types dealing with dynamic mutability |
char | Character manipulation ( |
clone | The |
cmp | The |
comm | Communication primitives for concurrent tasks |
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 | Generic hashing support. |
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 ( |
intrinsics | rustc compiler intrinsics. |
io | I/O, including files, networking, timers, and processes |
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 |
macros | Standard library macros |
mem | Basic functions for dealing with memory |
num | Numeric traits and functions for generic mathematics |
ops | Traits representing built-in operators, useful for overloading |
option | Optional values |
os | Higher-level interfaces to libc::* functions and operating system services. |
owned | Operations on unique pointer types |
path | Cross-platform path support |
prelude | The standard module imported by default into all Rust modules |
ptr | Unsafe pointer utility functions |
raw | Contains struct definitions for the layout of compiler built-in types. |
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 |
slice | Utilities for vector manipulation |
str | Unicode string manipulation ( |
sync | Useful synchronization primitives |
task | Utilities for managing and scheduling tasks |
to_str | The |
tuple | Operations on tuples |
ty | Types dealing with unsafe actions. |
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 ( |
unit | Functions for the unit type. |
vec | An owned, growable vector. |