better_default 1.0.5

The std Default derive, but it allows to constomize the default fields values and has some upgrades.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use quote::quote;

pub const DEFAULT_IDENT: &str = "default";

macro_rules! create_const_tokens {
    ($ident: ident = $($tt: tt)*) => {
        pub struct $ident;
        impl quote::ToTokens for $ident {
            fn to_tokens(&self, tokens: &mut crate::TokenStream2) {
                quote! { $($tt)* }.to_tokens(tokens)
            }
        }
    }
}

create_const_tokens!(DefaultTraitPath = core::default::Default);