Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 30, 2024
1 parent 4ef26f4 commit a4c8b20
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub struct Struct1

// = end of generated

// include!( "./only_test/primitives.rs" );
include!( "./only_test/primitives.rs" );
10 changes: 3 additions & 7 deletions module/core/former/tests/inc/former_tests/a_primitives_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl Struct1
{
pub fn former() -> Struct1Former
{
Struct1Former::new()
Struct1Former::new( the_module::ReturnPreformed )
}
}

Expand Down Expand Up @@ -207,7 +207,6 @@ where
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
on_end : < Definition as former::FormerDefinition >::End,
// xxx : cover by test existance of these 3 parameters in the function
) -> Self
{
if storage.is_none()
Expand Down Expand Up @@ -271,7 +270,6 @@ where
{

pub fn preform( self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed
// pub fn preform( self ) -> Struct1
{
former::StoragePerform::preform( self.storage )
}
Expand All @@ -281,16 +279,14 @@ where
impl Struct1Former
{

// xxx : should pass callback
#[ inline( always ) ]
pub fn new() -> Struct1Former
pub fn new( on_end : < Struct1FormerDefinition as former::FormerDefinition >::End ) -> Self
{
Struct1Former::begin( None, None, the_module::ReturnPreformed )
Self::begin( None, None, on_end )
}

}

//

// xxx : uncomment
include!( "./only_test/primitives.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tests_impls!
a_id!( former.storage.string_optional_1, None );
a_id!( former.context, None );
a_id!( print!( "{:?}", former.on_end ), print!( "{:?}", Some( the_module::ReturnPreformed ) ) );
let former2 = Struct1Former::new();
let former2 = Struct1Former::new( former::ReturnPreformed );
a_id!( std::mem::size_of_val( &former ), std::mem::size_of_val( &former2 ) );

let command = Struct1::former().form();
Expand Down Expand Up @@ -69,6 +69,17 @@ tests_impls!

//

fn new()
{

let former = Struct1::former();
let former2 = Struct1Former::new( former::ReturnPreformed );
a_id!( std::mem::size_of_val( &former ), std::mem::size_of_val( &former2 ) );

}

//

fn preform()
{

Expand Down Expand Up @@ -335,6 +346,7 @@ tests_index!
{
internals,
begin,
new,
preform,
definition,
storage,
Expand Down
2 changes: 1 addition & 1 deletion module/core/former/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod former_tests

mod a_primitives_manual;
// mod a_primitives_expanded;
// mod a_primitives;
mod a_primitives;
// mod a_containers_without_subformer_manual;
// mod a_containers_without_subformer;
// #[ cfg( not( feature = "no_std" ) ) ]
Expand Down
Loading

0 comments on commit a4c8b20

Please sign in to comment.