attribute-dsl
attribute-dsl provides syn parsers for Rust proc-macro attributes built from
a path root, ordered dot calls, optional labels, comma-separated entries, and
named groups. It also supports rust-analyzer completion probes and _
placeholders for application-owned subject types.
Use it in derive-macro and attribute-macro implementation crates. The consumer keeps ownership of domain validation, constructors, and generated Rust.
Quick start
Add the crate alongside the syn dependency used by the macro:
cargo add attribute-dsl
Parse an attribute chain through syn:
use ;
let chain: AttributeChain =
parse_str
.expect;
assert_eq!;
assert_eq!;
assert!;
The result retains syn::Path, syn::Ident, and syn::Expr nodes so the
consumer can preserve syntax and spans while quoting its expansion.
Capabilities
- Parse one chain, a labeled entry, a list, or a named group.
- Recover a trailing dot as a typed rust-analyzer completion probe.
- Inspect or replace
_type placeholders in paths, types, and expressions. - Return
syn::Errorvalues for spanned proc-macro diagnostics.
Documentation
- Follow the attribute-dsl guide for parser selection, completion probes, infer substitution, and expansion patterns.
- Use the API documentation for public items and signatures.