This skill helps optimize Rust performance and memory usage by applying caching, parallelization, and async strategies to compute-intensive tasks.
npx playbooks add skill cacr92/wereply --skill rust-optimization
mokarayon 或 tokio::task::spawn_blockinguse moka::future::Cache;
use std::time::Duration;
pub struct MaterialCache {
cache: Cache<String, crate::material::material::Material>,
}
impl MaterialCache {
pub fn new() -> Self {
Self {
cache: Cache::builder()
.max_capacity(1000)
.time_to_live(Duration::from_secs(3600))
.build(),
}
}
}
use rayon::prelude::*;
let totals: Vec<f64> = materials
.par_iter()
.map(|m| m.price)
.collect();
let result = tokio::task::spawn_blocking(move || heavy_calc(input))
.await?;
Arc,可变状态用 tokio::syncWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.