repowisetokio-rs/tokio

Architecture of tokio-rs/tokio

tokio-rs/tokio is 875 source files holding 11,207 symbols across 10 modules, written mainly in Rust. The largest module is tokio, with 576 files, and 10 files are entry points into the dependency graph.

How tokio fits together

The tokio directory holds 576 of the repository's 875 files and contains the core runtime. tokio/src/runtime/builder.rs is where a runtime is configured before it starts running. tokio/src/runtime/scheduler/multi_thread/worker.rs contains the worker logic of the multithreaded task scheduler that runs spawned tasks. tokio/src/runtime/blocking/pool.rs manages the pool that runs blocking work so it does not stall the scheduler threads. tokio/src/runtime/io/driver/uring.rs is one of the I/O driver files that the reactor uses to receive readiness events from the operating system. tokio-stream/src/lib.rs and tokio-macros/src/entry.rs are entry points for the tokio-stream and tokio-macros crates, which sit alongside the core crate.

Largest modules

  • tokio: 576 files and 83,365 lines of code
  • tokio-util: 91 files and 13,170 lines of code
  • tokio-stream: 72 files and 5,535 lines of code
  • examples: 20 files and 1,306 lines of code
  • benches: 18 files and 2,082 lines of code
  • tests-build: 16 files and 317 lines of code
  • tokio-test: 10 files and 1,195 lines of code
  • tests-integration: 9 files and 328 lines of code

Documentation

Repowise documents tokio in 643 pages generated from the source, 47 of them written explanations of the repository and its modules. Module guides include:

  • tokio/src/runtime/time_alt: Alternate Timer Implementation

More on tokio: summary and FAQ, codebase overview, code health.

Related guide: Best dependency graph tools for monorepos