tanager
Parse Rust literal struct expressions using syn.
about
tanager is intended for proc-macro authors who want to accept syntax that
resembles ordinary Rust struct expressions.
The crate provides a Parse trait and a derive macro for implementing it.
Parsed values are constructed directly from Rust literals and nested structures
rather than from custom attribute syntax.
Example
use Parse;
This can be used to parse syntax such as:
Most users will derive Parse and then use tanager::parse to parse a
proc_macro2::TokenStream.
The derive macro is available with the macros feature enabled.
Derive Attributes
#[tanager(crate = path)]
Overrides the path used to refer to the tanager crate in generated code.
This is primarily useful when re-exporting tanager or when the crate is
available under a different name.
#[tanager(default = expr)]
Provides a default value when a named field is omitted from the input.
The supplied expression is evaluated whenever the field is omitted.
License
Tanager is licensed under the MIT License. See LICENSE for details.
Contributing
Contributions are welcome.
Please follow the existing code style and conventions used throughout the project. If you're proposing a new feature or API, opening an issue first is often the easiest way to discuss the design.
Suggestions and new ideas are appreciated, but maintainership and final design decisions remain with the project owner.