1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{parenthesized, token, Result};
use crate::widgets::WidgetFuncMethod;
impl Parse for WidgetFuncMethod {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let ident = input.parse()?;
let turbofish = input.parse().ok();
let args = if input.peek(token::Paren) {
let inner_input;
parenthesized!(inner_input in input);
Some(Punctuated::parse_terminated(&inner_input)?)
} else {
None
};
Ok(Self {
ident,
turbofish,
args,
})
}
}