用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-rust --skill rust-macros命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 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 |
Master Rust's macro system: declarative macros (macro_rules!) and procedural macros.
macro_rules! vec_of_strings {
($($x:expr),* $(,)?) => {
vec![$($x.to_string()),*]
};
}
let v = vec_of_strings!["a", "b", "c"];
| Specifier | Matches |
|---|---|
ident | Identifier |
expr | Expression |
ty | Type |
pat | Pattern |
tt | Token tree |
literal | Literal |
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 };
[lib]
proc-macro = true
[dependencies]
syn = { version = "2", features = ["full"] }
quote = "1"
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()
}
cargo expand # Expand all macros
cargo expand main # Expand specific
| Problem | Solution |
|---|---|
| Hygiene issues | Use $crate:: |
| Order matters | Define before use |