用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-rust --skill rust-concurrency命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | rust-concurrency |
| description | Master Rust concurrency - threads, channels, and parallel iterators |
| sasmp_version | 1.3.0 |
| bonded_agent | rust-async-agent |
| bond_type | SECONDARY_BOND |
| version | 1.0.0 |
Master thread-based concurrency: threads, channels, synchronization, and parallel processing.
use std::thread;
let handle = thread::spawn(|| {
println!("Hello from thread!");
42
});
let result = handle.join().unwrap();
use std::sync::mpsc;
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
tx.send("message").unwrap();
});
println!("Got: {}", rx.recv().unwrap());
use std::sync::{Arc, Mutex};
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _ in 0..10 {
let counter = Arc::clone(&counter);
handles.push(thread::spawn(move || {
*counter.lock().unwrap() += 1;
}));
}
for h in handles { h.join().unwrap(); }
use rayon::prelude::*;
let sum: i32 = (0..1000)
.into_par_iter()
.map(|x| x * 2)
.sum();
// Parallel map
let results: Vec<_> = data.par_iter()
.map(|x| expensive(x))
.collect();
// Parallel sort
data.par_sort();
use std::sync::RwLock;
let data = RwLock::new(vec![]);
// Multiple readers
let read = data.read().unwrap();
// Single writer
let mut write = data.write().unwrap();
use std::sync::atomic::{AtomicUsize, Ordering};
let counter = AtomicUsize::new(0);
counter.fetch_add(1, Ordering::SeqCst);
| Problem | Solution |
|---|---|
| Deadlock | Lock in same order |
| Data race | Use Arc<Mutex> |
| Slow parallel | Increase work per thread |
基于 SOC 职业分类