Expand description
Parse Rust literal struct expressions using syn.
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 tanager::Parse;
#[derive(Parse)]
struct Config {
name: String,
enabled: bool,
}
// Parses:
// {
// name: "example",
// enabled: true,
// }Most users will derive Parse and then use parse to parse a
proc_macro2::TokenStream.
The derive macro is available with the macros feature enabled.
Traits§
- Parse
- Parses a value from a Rust literal expression.
Functions§
- parse
- Parses a value from a token stream.
- parse_
without_ container - Parses a value from a token stream without requiring its outer container.
Type Aliases§
- Parse
Stream - Result type used throughout
tanagerparsing APIs. Input to a Syn parser function. - Result
- Result type used throughout
tanagerparsing APIs. The result of a Syn parser.