3 releases (breaking)
Uses new Rust 2024
| 0.3.0 | Jan 21, 2026 |
|---|---|
| 0.2.0 | May 17, 2021 |
| 0.1.0 | Apr 12, 2021 |
#10 in #parser-derive
6KB
71 lines
Derive macros to automatically implement the Parsable trait from token-parser for tuple structs (unnamed fields).
Supports sequential parsing via parse_list (Parsable derive) or symbol parsing via FromStr (SymbolParsable derive).
Token Parser Derive
Derive macros for the token-parser crate. Automatically implements the Parsable trait for tuple structs.
Features
Parsable: Parses unnamed fields sequentially usingParsable::parse_next.SymbolParsable: Parses unnamed fields (single-field recommended) usingFromStrfrom a symbol string.
Usage
use token_parser::Parsable;
use token_parser_derive::{Parsable, SymbolParsable};
// Sequential parsing from parser
#[derive(Parsable)]
struct Point(f32, f32);
// Symbol parsing (e.g., numbers/strings)
#[derive(SymbolParsable)]
struct Token(String);
Dependencies
~135–520KB
~12K SLoC