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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
332 B
Rust
Raw Normal View History

2024-02-07 09:30:20 -06:00
//!
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,
{
2024-02-07 09:53:27 -06:00
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
2024-02-07 09:29:46 -06:00
let content;
syn::parenthesized!(content in input);
content.parse::<T>().map(Parenthesized)
}
}