スキル一覧に戻る
pluginagentmarketplace

rust-macros

by pluginagentmarketplace

Rust programming language roadmap plugin for Claude

1🍴 0📅 2026年1月5日
GitHubで見るManusで実行

SKILL.md


name: rust-macros description: Master Rust macros - declarative and procedural macros sasmp_version: "1.3.0" bonded_agent: rust-type-system-agent bond_type: SECONDARY_BOND version: "1.0.0"

Rust Macros Skill

Master Rust's macro system: declarative macros (macro_rules!) and procedural macros.

Quick Start

Declarative Macros

macro_rules! vec_of_strings {
    ($($x:expr),* $(,)?) => {
        vec![$($x.to_string()),*]
    };
}

let v = vec_of_strings!["a", "b", "c"];

Fragment Specifiers

SpecifierMatches
identIdentifier
exprExpression
tyType
patPattern
ttToken tree
literalLiteral

Repetition

macro_rules! hashmap {
    ($($key:expr => $value:expr),* $(,)?) => {{
        let mut map = std::collections::HashMap::new();
        $(map.insert($key, $value);)*
        map
    }};
}

let m = hashmap! { "one" => 1, "two" => 2 };

Procedural Macros

[lib]
proc-macro = true

[dependencies]
syn = { version = "2", features = ["full"] }
quote = "1"

Derive Macro

use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};

#[proc_macro_derive(HelloMacro)]
pub fn hello_derive(input: TokenStream) -> TokenStream {
    let input = parse_macro_input!(input as DeriveInput);
    let name = input.ident;

    quote! {
        impl HelloMacro for #name {
            fn hello() {
                println!("Hello from {}!", stringify!(#name));
            }
        }
    }.into()
}

Debugging

cargo expand              # Expand all macros
cargo expand main         # Expand specific

Troubleshooting

ProblemSolution
Hygiene issuesUse $crate::
Order mattersDefine before use

Resources

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です