Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/salsa/salsa-macros/src/parenthesized.rs')
| -rw-r--r-- | crates/salsa/salsa-macros/src/parenthesized.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/salsa/salsa-macros/src/parenthesized.rs b/crates/salsa/salsa-macros/src/parenthesized.rs new file mode 100644 index 0000000000..e981764460 --- /dev/null +++ b/crates/salsa/salsa-macros/src/parenthesized.rs @@ -0,0 +1,12 @@ +pub(crate) struct Parenthesized<T>(pub T); + +impl<T> syn::parse::Parse for Parenthesized<T> +where + T: syn::parse::Parse, +{ + fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { + let content; + syn::parenthesized!(content in input); + content.parse::<T>().map(Parenthesized) + } +} |