Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/miles990/claude-software-skills --skill rust명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Enterprise-grade repository analysis with arc42/C4 architecture documentation, technical debt quantification, security assessment, and multi-stakeholder reporting
Claude Code Plugin 開發、發布、安裝、更新與 Marketplace 管理完整指南
Flame Engine core fundamentals - components, input, collision, camera, animation, scenes
SOC 직업 분류 기준
SKILL.md 표시 중
| name | rust |
| description | Rust programming patterns and ownership concepts |
| domain | programming-languages |
| version | 1.0.0 |
| tags | ["rust","ownership","lifetimes","traits","async"] |
| triggers | {"keywords":{"primary":["rust","cargo","rustc","ownership","borrow","lifetime"],"secondary":["trait","async","tokio","serde","wasm","unsafe"]},"context_boost":["systems","performance","memory-safety","cli","webassembly"],"context_penalty":["python","javascript","java","go"],"priority":"high"} |
Rust programming patterns including ownership, lifetimes, traits, and async programming.
fn main() {
// Ownership transfer (move)
let s1 = String::from("hello");
let s2 = s1; // s1 is moved to s2
// println!("{}", s1); // Error: s1 is no longer valid
// Clone for deep copy
let s3 = String::from("hello");
let s4 = s3.clone();
println!("{} {}", s3, s4); // Both valid
// Copy types (stack-only data)
let x = 5;
let y = x; // Copy, not move
println!("{} {}", x, y); // Both valid
}
// Ownership and functions
fn takes_ownership(s: String) {
println!("{}", s);
} // s is dropped here
fn makes_copy(x: i32) {
println!("{}", x);
} // x goes out of scope, nothing special
fn gives_ownership() -> String {
String::from("hello")
}
fn takes_and_gives_back(s: String) -> String {
s
}
// Immutable borrow
fn calculate_length(s: &String) -> usize {
s.len()
} // s goes out of scope but doesn't drop the value
// Mutable borrow
fn append_world(s: &mut String) {
s.push_str(" world");
}
fn main() {
let s = String::from("hello");
// Multiple immutable borrows OK
let r1 = &s;
let r2 = &s;
println!("{} {}", r1, r2);
// Mutable borrow (only one at a time)
let mut s2 = String::from("hello");
let r3 = &mut s2;
r3.push_str(" world");
println!("{}", r3);
// Cannot have mutable and immutable at same time
let mut s3 = String::from("hello");
let = &s3;
(, r4);
}
// Explicit lifetime annotations
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { x } else { y }
}
// Struct with lifetime
struct Excerpt<'a> {
part: &'a str,
}
impl<'a> Excerpt<'a> {
fn level(&self) -> i32 {
3
}
fn announce_and_return(&self, announcement: &str) -> &str {
println!("Attention: {}", announcement);
self.part
}
}
// Multiple lifetimes
fn complex<'a, 'b>(x: &'a str, y: &'b str) -> &'a str
where
'b: 'a, // 'b outlives 'a
{
x
}
() & {
}
#[derive(Debug, Clone, PartialEq)]
struct User {
id: u64,
email: String,
name: String,
active: bool,
}
impl User {
// Associated function (constructor)
fn new(email: String, name: String) -> Self {
Self {
id: generate_id(),
email,
name,
active: true,
}
}
// Method
fn deactivate(&mut self) {
self.active = false;
}
// Method returning reference
fn email(&self) -> &str {
&self.email
}
}
// Tuple struct
struct Color(u8, u8, u8);
struct Point(f64, f64, f64);
// Unit struct
struct AlwaysEqual;
// Basic enum
enum Direction {
North,
South,
East,
West,
}
// Enum with data
enum Message {
Quit,
Move { x: i32, y: i32 },
Write(String),
ChangeColor(u8, u8, u8),
}
impl Message {
fn process(&self) {
match self {
Message::Quit => println!("Quit"),
Message::Move { x, y } => println!("Move to ({}, {})", x, y),
Message::Write(text) => println!("Write: {}", text),
Message::ChangeColor(r, g, b) => println!("Color: ({}, {}, {})", r, g, b),
}
}
}
// Result and Option
fn divide(a: f64, b: f64) -> Result<f64, String> {
if b == 0.0 {
Err(String::from("Division by zero"))
} else {
Ok(a / b)
}
}
fn (id: ) <User> {
}
// Trait definition
trait Summary {
fn summarize(&self) -> String;
// Default implementation
fn summarize_author(&self) -> String {
String::from("(unknown author)")
}
}
// Implement trait
impl Summary for User {
fn summarize(&self) -> String {
format!("{} ({})", self.name, self.email)
}
}
// Trait bounds
fn notify<T: Summary>(item: &T) {
println!("Breaking news: {}", item.summarize());
}
// Multiple trait bounds
fn notify_multiple<T: Summary + Clone>(item: &T) {
let cloned = item.clone();
println!("{}", cloned.summarize());
}
// where clause
fn some_function<T, U>(t: &T, u: &U)
T: Summary + ,
U: + std::fmt::,
{
}
() {
User::(
::(),
::(),
)
}
(items: &[& Summary]) {
items {
(, item.());
}
}
use std::fs::File;
use std::io::{self, Read};
use thiserror::Error;
// Custom error with thiserror
#[derive(Error, Debug)]
pub enum AppError {
#[error("IO error: {0}")]
Io(#[from] io::Error),
#[error("Parse error: {0}")]
Parse(#[from] std::num::ParseIntError),
#[error("Not found: {0}")]
NotFound(String),
#[error("Validation error: {field} - {message}")]
Validation { field: String, message: String },
}
// Using Result
fn read_file(path: &str) -> Result<String, AppError> {
let mut file = File::open(path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(contents)
}
// ? operator chains
fn read_username_from_file() -> Result<, io::Error> {
= ::();
File::()?.(& username)?;
(username)
}
(id: ) <> {
= (id)?;
= (&user)?;
(data)
}
(id: ) <> {
(id)
.(|user| user.email)
.(|email| !email.())
}
(s: &) <, std::num::ParseIntError> {
s.parse::<>().(|n| n * )
}
use tokio;
use futures::future;
// Async function
async fn fetch_data(url: &str) -> Result<String, reqwest::Error> {
let response = reqwest::get(url).await?;
let body = response.text().await?;
Ok(body)
}
// Concurrent execution
async fn fetch_all(urls: Vec<&str>) -> Vec<Result<String, reqwest::Error>> {
let futures: Vec<_> = urls.iter().map(|url| fetch_data(url)).collect();
future::join_all(futures).await
}
// Select (race)
use tokio::select;
use tokio::time::{sleep, Duration};
async fn fetch_with_timeout(url: &str) -> Result<String, &'static str> {
select! {
result = (url) => result.(|_| ),
_ = (Duration::()) => (),
}
}
(items: <>) {
: <_> = items
.()
.(|item| {
tokio::( {
(&item).
})
})
.();
handles {
(e) = handle. {
(, e);
}
}
}
futures::stream::{, StreamExt};
() {
= stream::([, , , , ]);
numbers
.(|n| { n * })
.()
.for_each(|n| {
(, n);
})
.;
}
tokio::sync::mpsc;
() {
(tx, rx) = mpsc::();
tokio::( {
.. {
tx.(i)..();
}
});
(value) = rx.(). {
(, value);
}
}
use std::collections::{HashMap, HashSet, VecDeque};
// Vec operations
let mut vec = vec![1, 2, 3];
vec.push(4);
vec.extend([5, 6, 7]);
let first = vec.first();
let last = vec.pop();
// HashMap
let mut map: HashMap<String, i32> = HashMap::new();
map.insert(String::from("key"), 42);
map.entry(String::from("key2")).or_insert(0);
// Iterator methods
let numbers = vec![1, 2, 3, 4, 5];
let doubled: Vec<_> = numbers.iter().map(|x| x * ).();
: = numbers.().();
: <_> = numbers.().(|x| *x % == ).();
= numbers.().(|&&x| x > );
= numbers.().(|x| *x > );
: = numbers
.()
.(|x| *x % == )
.(|x| x * )
.();
{
count: ,
max: ,
}
{
= ;
(& ) <::Item> {
.count < .max {
.count += ;
(.count)
} {
}
}
}
use std::rc::Rc;
use std::cell::RefCell;
use std::sync::{Arc, Mutex};
// Box - heap allocation
let boxed = Box::new(5);
let list = Box::new(Node {
value: 1,
next: Some(Box::new(Node { value: 2, next: None })),
});
// Rc - reference counting
let a = Rc::new(5);
let b = Rc::clone(&a);
let c = Rc::clone(&a);
println!("count: {}", Rc::strong_count(&a)); // 3
// RefCell - interior mutability
let cell = RefCell::new(5);
*cell.borrow_mut() += 1;
println!("{}", cell.borrow()); // 6
// Rc<RefCell<T>> - shared mutable state
let shared = Rc::new(RefCell::new([, , ]));
= Rc::(&shared);
shared.().();
shared2.().();
= Arc::();
= Arc::(&arc);
= Arc::(Mutex::());
: <_> = (..)
.(|_| {
= Arc::(&counter);
std::thread::( || {
= counter.().();
*num += ;
})
})
.();
handles {
handle.().();
}