Files
Frank 02883d3ed2 docs: rebuild KB in OKF v0.1 with live-verified facts
Copy of the legacy ~/.pi/agent/docs tree rebuilt as the command-center
knowledge base: concept files promoted to path identity, index listings
stripped of frontmatter, all wikilinks/relative links resolved, every
checkable claim verified against the live fleet (Dankserver = Ryzen 7
7700X + RTX 3090; Strix Halo is Dankclaw), unverifiable claims tagged.
kb-lint exits 0.
2026-08-28 07:57:13 -07:00

2.1 KiB

type, title, description, tags, timestamp, verified
type title description tags timestamp verified
reference Rust Current best practices for Rust projects - cargo, editions, web frameworks, and tooling.
rust
cargo
axum
bootstrap
engineering
2026-08-11 2026-08-28

CUT

Rust

This page covers current (2025/2026) best practices for Rust projects.

Bootstrap

Create a binary crate:

cargo new my-app --bin

Create a library crate:

cargo new my-lib --lib

New projects use the Rust 2024 edition by default.

Tooling

Category Tool Notes
Toolchain rustup Install with the rustup script.
Formatter rustfmt Run cargo fmt.
Linter clippy Run cargo clippy --all-targets --all-features.
Testing cargo test Unit tests in #[cfg(test)], integration tests in tests/.
Async runtime tokio The standard choice.

Use cargo clippy -- -D warnings in CI.

Workspaces

Use a Cargo workspace for projects with multiple crates. Declare members in the root Cargo.toml.

workspace-root/
├── Cargo.toml
└── crates/
    ├── app/
    └── core/

Web Frameworks

Framework Best For Notes
Axum 0.8 Most Rust web apps Most popular. Tokio team.
actix-web High-throughput services Slightly faster in benchmarks.
Rocket Developer experience Excellent ergonomics.

Use Axum for new web services.

Error Handling

Use thiserror for library error types. Use anyhow for application-level errors. The ? operator propagates errors.

Desktop and WASM

  • Use Tauri 2 for cross-platform desktop apps with a web frontend.
  • Use wasm-pack and wasm-bindgen for WebAssembly.
  • serde and serde_json for serialization.
  • clap for command-line interfaces.
  • tracing and tracing-subscriber for structured logging.
  • sqlx for compile-time checked SQL.
  • tonic for gRPC.
  • criterion for benchmarks.

Citations

See Also