diff --git a/module/core/former/tests/inc/former_tests/a_basic_manual.rs b/module/core/former/tests/inc/former_tests/a_basic_manual.rs index 9c53ca94d9..4aae2cdeae 100644 --- a/module/core/former/tests/inc/former_tests/a_basic_manual.rs +++ b/module/core/former/tests/inc/former_tests/a_basic_manual.rs @@ -32,8 +32,8 @@ impl Struct1 // = definition types #[ derive( Debug ) ] -// pub struct Struct1FormerDefinitionTypes< Context = (), Formed = Struct1 > -pub struct Struct1FormerDefinitionTypes< Context, Formed > +pub struct Struct1FormerDefinitionTypes< Context = (), Formed = Struct1 > +// pub struct Struct1FormerDefinitionTypes< Context, Formed > { _phantom : core::marker::PhantomData< ( Context, Formed ) >, } @@ -56,8 +56,8 @@ impl< Context, Formed > former::FormerDefinitionTypes for Struct1FormerDefinitio // = definition #[ derive( Debug ) ] -// pub struct Struct1FormerDefinition< Context = (), Formed = Struct1, End = former::ReturnPreformed > -pub struct Struct1FormerDefinition< Context, Formed, End > +pub struct Struct1FormerDefinition< Context = (), Formed = Struct1, End = former::ReturnPreformed > +// pub struct Struct1FormerDefinition< Context, Formed, End > { _phantom : core::marker::PhantomData< ( Context, Formed, End ) >, } @@ -138,7 +138,13 @@ impl former::StoragePreform for Struct1FormerStorage // = former -pub struct Struct1Former< Context, Formed, End, Definition = Struct1FormerDefinition< Context, Formed, End > > +pub struct Struct1Former +< + Context = (), + Formed = Struct1, + End = former::ReturnPreformed, + Definition = Struct1FormerDefinition< Context, Formed, End >, +> where End : former::FormingEnd::< Definition::Types >, Definition : former::FormerDefinition< End = End >, @@ -270,5 +276,5 @@ where // === end of generated -// include!( "./only_test/basic.rs" ); -// xxx : uncomment \ No newline at end of file +include!( "./only_test/basic.rs" ); +// xxx : uncomment diff --git a/module/core/former/tests/inc/former_tests/only_test/basic.rs b/module/core/former/tests/inc/former_tests/only_test/basic.rs index 0808110ac3..ae4cc70666 100644 --- a/module/core/former/tests/inc/former_tests/only_test/basic.rs +++ b/module/core/former/tests/inc/former_tests/only_test/basic.rs @@ -31,13 +31,19 @@ tests_impls! // +// xxx : uncomment fn custom_definition_params() { - // zzz : make example of that // custom params let got = Struct1Former - ::< Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > + > ::begin ( None, @@ -50,7 +56,13 @@ tests_impls! // custom params with into let got = Struct1Former - ::< Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > + > ::begin ( None, @@ -63,7 +75,13 @@ tests_impls! // custom params begin let got = Struct1Former - ::< Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > + > ::begin ( None, @@ -76,7 +94,32 @@ tests_impls! // custom params begin with Struct1FormerWithClosure let got = Struct1Former - ::< Struct1FormerWithClosure< i32, i32 > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > + > + ::begin + ( + None, + Some( 3 ), + | storage : Struct1FormerStorage, context : Option< i32 > | { 2 * ( storage.int_1.unwrap() + context.unwrap() ) } + ) + .int_1( 13 ) + .form(); + a_id!( got, 32 ); + + // less explicit + let got = Struct1Former + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< _ > > + > ::begin ( None, @@ -108,7 +151,14 @@ tests_impls! // begin with context let mut storage = Struct1FormerStorage::default(); storage.int_1 = Some( 13 ); - let exp = Struct1Former::< Struct1FormerDefinition > + let exp = Struct1Former + :: + < + _, + _, + _, + Struct1FormerDefinition + > ::begin( Some( storage ), Some( () ), the_module::ReturnPreformed ) .form(); a_id!( got, exp ); @@ -122,7 +172,14 @@ tests_impls! // custom params let got = Struct1Former - ::< Struct1FormerDefinition< i32, i32, _ > > + // ::< Struct1FormerDefinition< i32, i32, _ > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, _ > + > ::_begin_precise ( None, @@ -138,7 +195,14 @@ tests_impls! // custom params with into let got = Struct1Former - ::< Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > > + // ::< Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > > + > ::_begin_precise ( None, @@ -182,7 +246,14 @@ tests_impls! } let end_wrapper : former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > = former::FormingEndClosure::new( f1 ); let got = Struct1Former - ::< Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + // ::< Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > + > ::new( end_wrapper ) .int_1( 13 ) .form(); @@ -191,7 +262,14 @@ tests_impls! // default explicit params with wrapper and closure let got = Struct1Former - ::< Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + // ::< Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > + > ::new( former::FormingEndClosure::new( | storage, _context | { former::StoragePreform::preform( storage ) } ) ) .int_1( 13 ) .form(); @@ -200,7 +278,14 @@ tests_impls! // default explicit params with wrapper and closure, auto types let got = Struct1Former - ::< Struct1FormerDefinition< _, _, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + // ::< Struct1FormerDefinition< _, _, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > > + > ::new( former::FormingEndClosure::new( | storage, _context : Option< () > | { former::StoragePreform::preform( storage ) } ) ) .int_1( 13 ) .form(); @@ -209,7 +294,14 @@ tests_impls! // default explicit params with wrapper and closure let got = Struct1Former - ::< Struct1FormerWithClosure< (), Struct1 > > + // ::< Struct1FormerWithClosure< (), Struct1 > > + :: + < + _, + _, + _, + Struct1FormerWithClosure< (), Struct1 > + > ::new( former::FormingEndClosure::new( | storage, _context | { former::StoragePreform::preform( storage ) } ) ) .int_1( 13 ) .form(); @@ -218,7 +310,14 @@ tests_impls! // default explicit params with wrapper and closure let got = Struct1Former - ::< Struct1FormerWithClosure< (), Struct1 > > + // ::< Struct1FormerWithClosure< (), Struct1 > > + :: + < + _, + _, + _, + Struct1FormerWithClosure< (), Struct1 > + > ::new( | storage, _context | { former::StoragePreform::preform( storage ) } ) .int_1( 13 ) .form(); @@ -242,7 +341,14 @@ tests_impls! // default explicit params let got = Struct1Former - ::< Struct1FormerDefinition< (), Struct1, _ > > + // ::< Struct1FormerDefinition< (), Struct1, _ > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, _ >, + > ::_new_precise( former::ReturnPreformed ) .int_1( 13 ) .form(); @@ -256,7 +362,14 @@ tests_impls! } let end_wrapper : former::FormingEndClosure< Struct1FormerDefinitionTypes< (), Struct1 > > = former::FormingEndClosure::new( f1 ); let got = Struct1Former - ::< Struct1FormerDefinition< (), Struct1, _ > > + // ::< Struct1FormerDefinition< (), Struct1, _ > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, _ >, + > ::_new_precise( end_wrapper ) .int_1( 13 ) .form(); @@ -265,7 +378,14 @@ tests_impls! // default explicit params with wrapper and closure let got = Struct1Former - ::< Struct1FormerDefinition< (), Struct1, _ > > + // ::< Struct1FormerDefinition< (), Struct1, _ > > + :: + < + _, + _, + _, + Struct1FormerDefinition< (), Struct1, _ >, + > ::_new_precise( former::FormingEndClosure::new( | storage, _context | { former::StoragePreform::preform( storage ) } ) ) .int_1( 13 ) .form(); @@ -274,7 +394,14 @@ tests_impls! // default explicit params with wrapper and closure, auto types let got = Struct1Former - ::< Struct1FormerDefinition< _, _, _ > > + // ::< Struct1FormerDefinition< _, _, _ > > + :: + < + _, + _, + _, + Struct1FormerDefinition< _, _, _ >, + > ::_new_precise( former::FormingEndClosure::new( | storage, _context : Option< () > | { former::StoragePreform::preform( storage ) } ) ) .int_1( 13 ) .form(); diff --git a/module/core/former/tests/inc/mod.rs b/module/core/former/tests/inc/mod.rs index 8e35ae8e1c..d1b3cec0d8 100644 --- a/module/core/former/tests/inc/mod.rs +++ b/module/core/former/tests/inc/mod.rs @@ -17,7 +17,7 @@ mod former_tests mod container_former_hashmap; mod a_basic_manual; - mod a_basic; + // mod a_basic; // xxx mod a_primitives_manual; mod a_primitives; mod a_containers_without_subformer;