Created
December 19, 2022 06:29
-
-
Save sam0x17/34ddc2eeac99753a3370e610b3c5e993 to your computer and use it in GitHub Desktop.
bare block parsing implementation using syn (parse the contents of a block without braces)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct BareBlock { | |
stmts: Vec<Stmt>, | |
} | |
impl Parse for BareBlock { | |
fn parse(input: ParseStream) -> syn::Result<Self> { | |
match Block::parse_within(input) { | |
Ok(stmts) => Ok(BareBlock { stmts }), | |
Err(e) => Err(e), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment