Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides Rust guidance on error handling, API design, performance, and idiomatic patterns, based on Microsoft Pragmatic Rust Guidelines.
72% 96%+24 ptsof test cases passed
Passed 24 of 25 test cases with the skill, and 18 of 25 without it.
I am writing a helper function in Rust that prints a list of tags. I want callers to be able to pass a `&[&str]`, `Vec<String>`, or custom iterator of string references without allocating memory or converting types. How should the function parameter be declared?
The helper function parameter is typed as impl IntoIterator<Item = impl AsRef<str>>.
3 of 3 safety checks passed
Based on Microsoft Pragmatic Rust Guidelines and Rust community standards.
thiserror for Librariesuse thiserror::Error;
#[derive(Error, Debug)]
pub enum MyError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Parse error at line {line}: {message}")]
Parse { line: usize, message: String },
#[error("Not found: {0}")]
NotFound(String),
}
anyhow for Applicationsuse anyhow::{Context, Result};
fn main() -> Result<()> {
let config = load_config()
.context("Failed to load configuration")?;
run_app(config)?;
Ok(())
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.