The standard library contains the core functionality for Rust. It is split into four parts:
- The standard modules
- Primitive types
- Macros
- Prelude
The standard modules implement the likes of string handling, IO, network, and operating system calls. There are around 60 of these modules in total. Some are self-contained while others provide implementations for traits and structs.
The module names may give rise to some confusion as they share the same name with a primitive type (such as i32
).
Primitive types are those types that are provided for us. In other languages, they would be the likes of int
, float
, and char
. In Rust, we have i32
, d32
, and i8
(respectively). Rust provides the developer with 19 primitives, some of which will provide additional implementations.