complete-rust-development
A comprehensive skill for Rust development that combines error handling, testing, and logging patterns. Demonstrates the 'includes' composition feature by merging content from multiple standalone skills.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Complete Rust Development
A comprehensive Rust development skill that combines error handling, testing, and logging patterns through composition.
This skill demonstrates the includes feature:
- Error handling rules from
rust-error-handlingare merged into Rules - Testing checklist from
testing-patternsis merged into Checklist - Logging rules from
logging-patternsare merged into Rules with a prefix
Rules
- Follow Rust idioms and conventions
- Use
clippyfor linting:cargo clippy -- -D warnings - Format code with
rustfmt:cargo fmt - Keep unsafe blocks minimal and well-documented
Examples
// Idiomatic Rust with proper error handling, logging, and tests
use anyhow::{Context, Result};
use tracing::{info, instrument};
#[instrument]
pub fn process_data(input: &str) -> Result<Output> {
info!("processing data");
let parsed = parse_input(input)
.context("failed to parse input")?;
let result = transform(parsed)
.context("transformation failed")?;
info!(output_size = result.len(), "processing complete");
Ok(result)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_process_data_happy_path() {
let input = "valid input";
let result = process_data(input);
assert!(result.is_ok());
}
#[test]
fn test_process_data_invalid_input() {
let input = "";
let result = process_data(input);
assert!(result.is_err());
}
}
Checklist
- Code passes
cargo clippy -- -D warnings - Code is formatted with
cargo fmt - No
unsafeblocks (or they are justified and documented) - Dependencies are minimal and audited
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-28
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!