Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 29, 2024
1 parent 638f7e1 commit a3a3b64
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
20 changes: 18 additions & 2 deletions module/core/former/tests/inc/former_tests/a_primitives_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 >
{
Expand Down Expand Up @@ -279,4 +295,4 @@ impl Struct1Former
//

// xxx : uncomment
// include!( "./only_test/primitives.rs" );
include!( "./only_test/primitives.rs" );
18 changes: 12 additions & 6 deletions module/core/former/tests/inc/former_tests/only_test/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit a3a3b64

Please sign in to comment.