thecodex.expert · The Codex Family of Knowledge
Rust

Standard Library

Rust deliberately keeps std smaller than Go's or Python's — no async runtime, no HTTP client — leaving those to crates.io by design, not oversight.

Rust 1.96 std Last verified:
Canonical Definition

std covers the fundamentals: collections (Vec, HashMap, already covered), string handling, file and network IO, environment and process interaction, and synchronization primitives. Unlike Go's batteries-included philosophy, Rust deliberately keeps std smaller — there is no built-in async runtime, HTTP client, or JSON parser — leaving those to well-established crates.io packages (Tokio, reqwest, serde) instead, so std can stay stable and small while the ecosystem iterates faster around it.

File and console IO

std::fs covers reading and writing files; std::io provides the Read/Write traits and buffered wrappers that most of std's IO types implement, similar in spirit to Go's io.Reader/io.Writer.

Rustfile_io.rs
use std::fs;

let contents = fs::read_to_string("config.txt")?;
fs::write("output.txt", "hello")?;

use std::io::{self, Write};
print!("Enter name: ");
io::stdout().flush()?;   // ensure the prompt shows before reading input

Environment and process

std::env reads command-line arguments and environment variables; std::process spawns and manages child processes.

Rustenv_process.rs
use std::env;

let args: Vec<String> = env::args().collect();
let port = env::var("PORT").unwrap_or_else(|_| String::from("8080"));

println!("Args: {:?}, Port: {}", args, port);

What's deliberately NOT in std

No async runtime (use Tokio), no HTTP client (use reqwest), no JSON/YAML parsing (use serde with serde_json/serde_yaml), no regular expressions (use the regex crate), no logging framework beyond the basic log facade (paired with a crate like env_logger or tracing). This is a deliberate design choice, not a gap — it lets these areas evolve at the pace of the ecosystem rather than being locked to Rust's own release cadence.

Sources

1
The Rust Project. The Rust Standard Library documentation, doc.rust-lang.org/std.