소스 정보
- 저장소
- tokio-rs/topcoat
- 최근 소스 활동
- 2026년 7월 30일 11:31
- 감지된 SKILL.md 언어
- 영어
- 스타
- 4,809
- 포크
- 175
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tokio-rs/topcoat --skill macro명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | macro |
| description | Always use this skill before writing procedural macros for Topcoat |
syn nodes, an AST node is a lossless record of the syntax it matched: every field is pub and holds the tokens as written, spans included. The original source should be reconstructible from the node. Field order does not have to match the source, but spans must be preserved.Parse impl rejects what is not valid syntax and stores everything else verbatim in token fields; it never normalizes, resolves, or drops information on the way in.Parse impls, parse directly into the Self { ... } fields (Self { x: input.parse()? }) rather than through let bindings. Use a let only when a parsed value must be inspected to decide how to parse a later field.mod kw with syn::custom_keyword! invocations instead of parsing syn::Ident. Use input.lookahead1() if it makes sense.ParseOption and parse them with input.call(Node::parse_option)?.The macro/ crate only bridges proc_macro::TokenStream to the grammar crate that holds the AST and the codegen. Every entry point is a parse, a match, and a to_compile_error() on the error arm; no logic lives in lib.rs.
An attribute macro receives two token streams, so it gets three types: one Parse node per stream and a tuple struct pairing them, which is the node the codegen hangs off.
// grammar crate
pub struct ProcedureAttr {}
pub struct ProcedureItem { ... }
pub struct Procedure(ProcedureAttr, ProcedureItem);
impl Procedure {
#[must_use]
pub fn new(attr: ProcedureAttr, item: ProcedureItem) -> Self {
Self(attr, item)
}
pub fn parse(attr: TokenStream, item: TokenStream) -> syn::Result<Self> {
Ok(Self::new(syn::parse2(attr)?, syn::parse2(item)?))
}
}
impl ToTokens for Procedure { ... }
Parse stays per stream, since neither stream alone is the macro input. The pairing type owns the inherent parse that joins them and the ToTokens impl that expands them, which keeps the entry point a one-liner:
// macro crate
#[doc = include_str!("../docs/procedure.md")]
#[proc_macro_attribute]
pub fn procedure(attr: TokenStream, item: TokenStream) -> TokenStream {
match topcoat_runtime_grammar::procedure::Procedure::parse(attr.into(), item.into()) {
Ok(value) => quote! { #value }.into(),
Err(error) => error.to_compile_error().into(),
}
}
A function-like macro has a single input, so it needs no pairing type: syn::parse_macro_input! straight into its AST node, then expand.
Always use this skill before writing or editing Rust code or documentation in the Topcoat repository
Always use this skill to verify a change locally before committing or opening a pull request in the Topcoat repository
Always use this skill before writing long form markdown documentation for Topcoat.