Implement new BeaconStateTypes trait in types

This commit is contained in:
Paul Hauner
2019-05-08 13:08:37 +10:00
parent 009d05cafd
commit 5ba069c774
52 changed files with 323 additions and 144 deletions

View File

@@ -21,6 +21,7 @@ fn should_use_default(field: &syn::Field) -> bool {
pub fn test_random_derive(input: TokenStream) -> TokenStream {
let derived_input = parse_macro_input!(input as DeriveInput);
let name = &derived_input.ident;
let (impl_generics, ty_generics, where_clause) = &derived_input.generics.split_for_impl();
let struct_data = match &derived_input.data {
syn::Data::Struct(s) => s,
@@ -48,8 +49,8 @@ pub fn test_random_derive(input: TokenStream) -> TokenStream {
}
let output = quote! {
impl<T: RngCore> TestRandom<T> for #name {
fn random_for_test(rng: &mut T) -> Self {
impl #impl_generics TestRandom for #name #ty_generics #where_clause {
fn random_for_test(rng: &mut impl rand::RngCore) -> Self {
Self {
#(
#quotes