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 1effc15 commit 2d07383
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
32 changes: 19 additions & 13 deletions module/core/former/tests/inc/former_tests/a_primitives_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ where
}

#[ inline( always ) ]
pub fn begin_explicit
pub fn begin_precise
(
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
Expand Down Expand Up @@ -306,25 +306,31 @@ where

// zzz : update description
#[ inline( always ) ]
pub fn new( on_end : Definition::End ) -> Self
pub fn new_precise( on_end : Definition::End ) -> Self
{
Self::begin_explicit( None, None, on_end )
Self::begin_precise( None, None, on_end )
}

// zzz : update description
#[ inline( always ) ]
pub fn new_with< IntoEnd >( end : IntoEnd ) -> Self
where
IntoEnd : Into< Definition::End >,
pub fn new( on_end : Definition::End ) -> Self
{
Self::begin
(
None,
None,
end.into(),
)
Self::begin_precise( None, None, on_end )
}

// zzz : use
// #[ inline( always ) ]
// pub fn new< IntoEnd >( end : IntoEnd ) -> Self
// where
// IntoEnd : Into< Definition::End >,
// {
// Self::begin
// (
// None,
// None,
// end.into(),
// )
// }

}

impl< Definition > Struct1Former< Definition >
Expand Down
18 changes: 14 additions & 4 deletions module/core/former/tests/inc/former_tests/only_test/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ tests_impls!

//

fn begin_explicit()
fn begin_precise()
{

// custom params
let got = Struct1Former
::< Struct1FormerDefinition< i32, i32, _ > >
::begin_explicit
::begin_precise
(
None,
Some( 3 ),
Expand All @@ -188,7 +188,7 @@ tests_impls!
// custom params with into
let got = Struct1Former
::< Struct1FormerDefinition< i32, i32, former::FormingEndWrapper< Struct1FormerDefinitionTypes< i32, i32 > > > >
::begin_explicit
::begin_precise
(
None,
Some( 3 ),
Expand All @@ -207,9 +207,19 @@ tests_impls!
fn new()
{

let former = Struct1::former();
let former2 = Struct1Former::< Struct1FormerDefinition >::new_precise( former::ReturnPreformed );
a_id!( std::mem::size_of_val( &former ), std::mem::size_of_val( &former2 ) );
let exp = former.form();
let got = former2.form();
a_id!( got, exp );

let former = Struct1::former();
let former2 = Struct1Former::< Struct1FormerDefinition >::new( former::ReturnPreformed );
a_id!( std::mem::size_of_val( &former ), std::mem::size_of_val( &former2 ) );
let exp = former.form();
let got = former2.form();
a_id!( got, exp );

}

Expand Down Expand Up @@ -481,7 +491,7 @@ tests_index!
{
internals,
begin,
begin_explicit,
begin_precise,
new,
custom_definition_params,
preform,
Expand Down

0 comments on commit 2d07383

Please sign in to comment.