Skip to content
La3 Docs
Browse docs

Modules and Stdlib

Module visibility, imports, and the a-la-carte standard library model.

Modules

Modules group code by concern and hide internals by default.

  • pub marks the exported surface.
  • use pulls names into scope.
  • :: navigates module namespaces, while . reaches into values.
mod codec {
    pub fn encode(frame: &Frame) -> List<u8> { ... }
    fn checksum(data: &[u8]) -> u32 { ... }
}

Standard library surface

The stdlib is split into many focused modules instead of one monolith.

  • io, fs, os, json, math, bytes, and string helpers cover the common examples.
  • Async primitives such as all and race are top-level helpers.
  • The docs should make clear which modules are assumed and which are explicitly imported.

Independence

Each module should be useful on its own, without silently dragging in a second one.

  • Modules can share implementations opportunistically when present together.
  • The alone case always remains self-contained.
  • The granular and monolithic profiles must behave the same.

Async primitives

all waits for everything, race takes the first result, and both are part of the library vocabulary.

  • They are the common async shapes a reader expects to see in documentation.
  • They belong in the stdlib surface because they make the concurrency examples shorter and clearer.
  • The docs should explain them in the same place where the concurrency model is introduced.