1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, ToTokens};
use crate::widgets::WidgetFuncMethod;
impl ToTokens for WidgetFuncMethod {
fn to_tokens(&self, tokens: &mut TokenStream2) {
let WidgetFuncMethod {
ident,
turbofish,
args,
} = &self;
tokens.extend(if let Some(args) = args {
quote! {
#ident #turbofish (#args)
}
} else {
quote! {
#ident #turbofish
}
});
}
}