burn-derive 0.22.0-pre.1

Derive crate for the Burn framework
Documentation
1
2
3
4
5
6
7
8
9
10
use quote::quote;

pub fn display_fn(_ast: &syn::DeriveInput) -> proc_macro2::TokenStream {
    quote! {
        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
            let formatted = burn::module::ModuleDisplay::format(self, Default::default());
            write!(f, "{}", formatted)
        }
    }
}