From a3a3b64f21742fe9692e431da3e469f8511e65e7 Mon Sep 17 00:00:00 2001 From: wandalen Date: Fri, 29 Mar 2024 23:23:40 +0200 Subject: [PATCH] former : experimenting --- .../inc/former_tests/a_primitives_manual.rs | 20 +++++++++++++++++-- .../inc/former_tests/only_test/primitives.rs | 18 +++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/module/core/former/tests/inc/former_tests/a_primitives_manual.rs b/module/core/former/tests/inc/former_tests/a_primitives_manual.rs index 5cf8fb2bb3..b26549a0c3 100644 --- a/module/core/former/tests/inc/former_tests/a_primitives_manual.rs +++ b/module/core/former/tests/inc/former_tests/a_primitives_manual.rs @@ -26,7 +26,7 @@ impl Struct1 // #[ derive( Debug, Default ) ] // pub struct Struct1FormerDefinition; -#[ derive( Debug, Default ) ] +#[ derive( Debug ) ] pub struct Struct1FormerDefinition< Context = (), Formed = Struct1, End = former::ReturnPreformed > // xxx : use? // where @@ -35,6 +35,22 @@ pub struct Struct1FormerDefinition< Context = (), Formed = Struct1, End = former _phantom : core::marker::PhantomData< ( Context, Formed, End ) >, } +impl< Context, Formed, End > Default +for Struct1FormerDefinition< Context, Formed, End > +// where +// Context : Default, +// Formed : Default, +// End : Default, +{ + fn default() -> Self + { + Struct1FormerDefinition + { + _phantom : core::marker::PhantomData, + } + } +} + impl< Context, Formed > former::FormerDefinitionTypes for Struct1FormerDefinition< Context, Formed, former::NoEnd > { @@ -279,4 +295,4 @@ impl Struct1Former // // xxx : uncomment -// include!( "./only_test/primitives.rs" ); +include!( "./only_test/primitives.rs" ); diff --git a/module/core/former/tests/inc/former_tests/only_test/primitives.rs b/module/core/former/tests/inc/former_tests/only_test/primitives.rs index b09e881925..9697da9b4a 100644 --- a/module/core/former/tests/inc/former_tests/only_test/primitives.rs +++ b/module/core/former/tests/inc/former_tests/only_test/primitives.rs @@ -82,16 +82,22 @@ tests_impls! { // default is implemented for definition - let _default = Struct1FormerDefinition::default(); + let _default = Struct1FormerDefinition::< () >::default(); + // let _default = Struct1FormerDefinition::default(); // why does not work? - // definition types exists and has Formed - let got = < Struct1FormerDefinition as the_module::FormerDefinitionTypes >::Formed::former().form(); - let exp = Struct1::former().form(); - a_id!( got, exp ); + // impl< Context, Formed, End > Default + + // // definition types exists and has Formed + // let got = < Struct1FormerDefinition as the_module::FormerDefinitionTypes >::Formed::former().form(); + // let exp = Struct1::former().form(); + // a_id!( got, exp ); + // xxx : uncomment + + // < Context = (), Formed = Struct1, End = former::ReturnPreformed > // definition types exists and has Storage use former::StoragePerform; - let got = < Struct1FormerDefinition as the_module::FormerDefinitionTypes >::Storage::preform( Struct1::former().storage ); + let got = < Struct1FormerDefinition< (), Struct1, former::NoEnd > as the_module::FormerDefinitionTypes >::Storage::preform( Struct1::former().storage ); let exp = Struct1::former().form(); a_id!( got, exp );