소스 정보
- 저장소
- pluginagentmarketplace/custom-plugin-rust
- 최근 소스 활동
- 2025년 12월 30일 04:25
- 감지된 SKILL.md 언어
- 영어
- 스타
- 1
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-rust --skill trait-generics명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | trait-generics |
| description | Master Rust traits, generics, and type system |
| sasmp_version | 1.3.0 |
| bonded_agent | rust-type-system-agent |
| bond_type | PRIMARY_BOND |
| version | 1.0.0 |
Master Rust's powerful type system with traits and generics.
pub trait Summary {
// Required method
fn summarize(&self) -> String;
// Default implementation
fn preview(&self) -> String {
format!("Read more: {}", self.summarize())
}
}
struct Article {
title: String,
author: String,
content: String,
}
impl Summary for Article {
fn summarize(&self) -> String {
format!("{} by {}", self.title, self.author)
}
}
// impl Trait syntax
fn print_summary(item: &impl Summary) {
println!("{}", item.summarize());
}
// Trait bound syntax
fn print_summary<T: Summary>(item: &T) {
println!("{}", item.summarize());
}
// Multiple bounds
fn process<T: Summary + Clone>(item: &T) {
let copy = item.clone();
println!("{}", copy.summarize());
}
// Where clause
fn complex<T, U>(t: T, u: U)
where
T: Summary + Clone,
U: std::fmt::Debug,
{
// ...
}
struct Point<T> {
x: T,
y: T,
}
impl<T> Point<T> {
fn new(x: T, y: T) -> Self {
Point { x, y }
}
}
// Specific implementations
impl Point<f64> {
fn distance(&self) -> f64 {
(self.x.powi(2) + self.y.powi(2)).sqrt()
}
}
// Static dispatch (monomorphization, zero-cost)
fn process_static(item: &impl Summary) {
println!("{}", item.summarize());
}
// Dynamic dispatch (trait object, runtime cost)
fn process_dynamic(item: &dyn Summary) {
println!("{}", item.summarize());
}
// Collection of different types
let items: Vec<Box<dyn Summary>> = vec![
Box::new(article),
Box::new(tweet),
];
trait Container {
type Item;
fn get(&self, index: usize) -> Option<&Self::Item>;
}
impl<T> Container for Vec<T> {
type Item = T;
fn get(&self, index: usize) -> Option<&Self::Item> {
<[T]>::get(self, index)
}
}
use std::ops::Add;
#[derive(Debug, Copy, Clone)]
struct Point {
x: i32,
y: i32,
}
impl Add for Point {
type Output = Point;
fn add(self, other: Point) -> Point {
Point {
x: self.x + other.x,
y: self.y + other.y,
}
}
}
let p3 = p1 + p2; // Uses Add trait
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
struct Config {
timeout: u64,
retries: u32,
}
| Trait | Purpose |
|---|---|
| Debug | {:?} formatting |
| Clone | Explicit deep copy |
| Copy | Implicit bitwise copy |
| PartialEq | == comparison |
| Eq | Total equality |
| Hash | Use in HashMap |
| Default | Default::default() |