rust/crates/salsa/salsa-macros/src/parenthesized.rs

13 lines
324 B
Rust
Raw Normal View History

2024-02-07 09:30:13 -06:00
pub(crate) struct Parenthesized<T>(pub(crate) T);
2024-02-07 09:29:46 -06:00
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)
}
}