nitron-macros 0.1.1

Create native UIs in Rust
Documentation
use proc_macro::TokenStream;
use quote::quote;
use syn::{ItemFn, parse_macro_input};

pub fn parse_widget(input: TokenStream) -> TokenStream {
    let input = parse_macro_input!(input as ItemFn);

    let attrs = input.attrs;
    let vis = input.vis;
    let sig = input.sig;
    let block = input.block;

    let name = sig.ident;
    let params = sig.inputs;
    let ret = sig.output;

    quote! {
        #(#attrs)*
        #[derive(nitron::__macros::bon::Builder)]
        #[builder(crate = ::nitron::__macros::bon)]
        #vis struct #name {
            #params
        }

        impl #name {
            pub fn construct_widget(self) #ret {
                #block
            }
        }
    }
    .into()
}

// But now, O Lord, you are our Father; we are the clay, and you are our potter; we are all the work of your hand. - Isaiah 64:8