loom-rust

Solid

Rust language expertise for idiomatic, production-quality code. Use for ownership and lifetimes, error handling with anyhow/thiserror, async/await with tokio, cargo workspace management, CLI tools with clap, and serialization with serde. Primary language of the Loom project.

AI & Automation 53 stars 0 forks Updated today MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
58
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Rust Language Expertise ## Overview Idiomatic, production-quality Rust for an engineer who already knows ownership/borrowing. This skill is decision rules, gotchas, and the traps that cost hours: async/`Send` correctness, error-handling architecture, serde pitfalls, and edition-2024 features. Assumes the borrow checker itself is not the problem — using it *well* is. ## Error Handling: anyhow vs thiserror **The decision rule:** will a caller ever `match` on the error to recover? → `thiserror` (concrete, matchable enum). Does the error only bubble up to be logged/reported? → `anyhow` (type-erased, context chains). **Never put `anyhow::Error` in a library's public API** — it erases the type and denies callers any recovery. Libraries expose `thiserror` enums; binaries/apps consume with `anyhow`. ```rust // Library boundary: thiserror. Each variant = a distinct, matchable failure mode. use thiserror::Error; #[derive(Error, Debug)] pub enum ParseError { #[error("IO error: {0}")] Io(#[from] std::io::Error), // #[from] gives `?` conversion for free #[error("invalid syntax at {line}:{column}: {message}")] Syntax { line: usize, column: usize, message: String }, #[error("unexpected token: expected {expected}, found {found}")] Unexpected { expected: String, found: String }, #[error(transparent)] // wrap another error without adding a layer Other(#[from] anyhow::Error), } ``` ```rust // Application code: anyhow. `?` unifies heterogeneous errors; .c...

Details

Author
cosmix
Repository
cosmix/loom
Created
8 months ago
Last Updated
today
Language
Rust
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category