The Rust core library provides runtime features required by the language, including the task scheduler and memory allocators, as well as library support for Rust built-in types, platform abstractions, and other commonly used features.
core
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
). Additionally, core
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
).
core
is imported at the topmost level of every crate by default, as if the first line of each crate was
extern mod core;
This means that the contents of core can be accessed from from any context with the core::
path prefix, as in use core::vec
, use core::task::spawn
, etc.
Additionally, core
contains a prelude
module that reexports many of the most common core modules, types and traits. The contents of the prelude are imported inte every module by default. Implicitly, all modules behave as if they contained the following prologue:
use core::prelude::*;
at_vec
- Managed vectorsbool
- Boolean logiccast
- Unsafe casting functionscell
- A mutable, nullable memory locationchar
- Utilities for manipulating the char typeclone
- The Clone trait for types that cannot be "implicitly copied"cmp
- The Ord
and Eq
comparison traitscomm
- Message passingcondition
- Condition handlingcontainer
- Container traitsdlist
- A doubly-linked listeither
- A type that represents one of two alternativesf32
- Operations and constants for f32
f64
- Operations and constants for f64
flate
- Simple compressionfloat
- Operations and constants for float
from_str
- The trait for types that can be created from stringshash
- Implementation of SipHash 2-4hashmap
- An unordered map and set type implemented as hash tablesi16
- Operations and constants for i16
i32
- Operations and constants for i32
i64
- Operations and constants for i64
i8
- Operations and constants for i8
int
- Operations and constants for int
io
- Basic input/outputiter
- The iteration traits and common implementationkinds
- The kind traitslibc
- Bindings for libc.logging
- Loggingmanaged
- Operations on managed box typesmutable
- Module for wrapping freezable data structures in managed boxesnil
- Functions for the unit type.num
- An interface for numeric typesops
- Traits for the built-in operatorsoption
- Operations on the ubiquitous Option
type.os
- Higher-level interfaces to libc::* functions and operating system services.owned
- Operations on unique pointer typespath
- Cross-platform file path handlingpipes
- Runtime support for message passing with protocol enforcement.prelude
- The Rust preludeptr
- Unsafe pointer utility functionsrand
- Random number generationreflect
- Runtime type reflectionrepr
- More runtime type reflectionresult
- A type representing either success or failurerun
- Process spawningstr
- String manipulationsys
- Misc low level stufftask
- Task management.to_bytes
- The ToBytes
and IterBytes
traitsto_str
- The ToStr
trait for converting to stringstrie
- An ordered map and set for integer keys implemented as a radix trietuple
- Operations on tuplesu16
- Operations and constants for u16
u32
- Operations and constants for u32
u64
- Operations and constants for u64
u8
- Operations and constants for u8
uint
- Operations and constants for uint
util
- Miscellaneous helpers for common patterns.vec
- Vectors