mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-02-02 09:46:06 +00:00
move parenthesized
to its own module
This commit is contained in:
parent
d510b28fe2
commit
d15be76350
3 changed files with 14 additions and 13 deletions
|
@ -9,6 +9,7 @@ extern crate quote;
|
|||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
mod parenthesized;
|
||||
mod query_group;
|
||||
|
||||
/// The decorator that defines a salsa "query group" trait. This is a
|
||||
|
|
12
components/salsa-macros/src/parenthesized.rs
Normal file
12
components/salsa-macros/src/parenthesized.rs
Normal file
|
@ -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)
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
use crate::parenthesized::Parenthesized;
|
||||
use heck::CamelCase;
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::Span;
|
||||
|
@ -258,16 +259,3 @@ enum QueryStorage {
|
|||
Dependencies,
|
||||
Input,
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue