Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 30, 2024
1 parent be26b74 commit e286984
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions module/core/former/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where

/// Begins the building process, optionally initializing with a context and storage.
#[ inline( always ) ]
pub fn begin_precise
pub fn begin
(
mut storage : core::option::Option< < Definition::Types as FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as FormerDefinitionTypes >::Context >,
Expand Down Expand Up @@ -229,7 +229,7 @@ where
#[ inline( always ) ]
pub fn new( end : Definition::End ) -> Self
{
Self::begin_precise
Self::begin
(
None,
None,
Expand All @@ -243,7 +243,7 @@ where
where
IntoEnd : Into< Definition::End >,
{
Self::begin_precise
Self::begin
(
None,
None,
Expand Down Expand Up @@ -289,7 +289,7 @@ where
)
-> Self
{
Self::begin_precise( storage, context, on_end )
Self::begin( storage, context, on_end )
}

}
4 changes: 2 additions & 2 deletions module/core/former/tests/inc/former_tests/a_basic_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ where
}

#[ inline( always ) ]
pub fn begin_precise
pub fn begin
(
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 @@ -308,7 +308,7 @@ where
-> Self
{
debug_assert!( storage.is_none() );
Self::begin_precise( None, context, on_end )
Self::begin( None, context, on_end )
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ where
#[doc = r" Begin the process of forming. Expects context of forming to return it after forming."]
#[doc = r""]
#[inline(always)]
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>, on_end: <Definition as former::FormerDefinition>::End,) -> Self
pub fn begin(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,) -> Self
{
if storage.is_none()
{
Expand Down Expand Up @@ -441,7 +441,7 @@ where
fn former_begin(storage: core::option::Option<Definition::Storage>, context: core::option::Option<Definition::Context>, on_end: Definition::End,) -> Self
{
debug_assert!(storage.is_none());
Self::begin_precise(None, context, on_end)
Self::begin(None, context, on_end)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
#[ inline( always ) ]
pub fn new( on_end : Definition::End ) -> Self
{
Self::begin_precise( None, None, on_end )
Self::begin( None, None, on_end )
}

#[ inline( always ) ]
Expand All @@ -224,7 +224,7 @@ where
}

#[ inline( always ) ]
pub fn begin_precise
pub fn begin
(
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn begin_and_custom_end()
{
13.1
}
let got = the_module::VectorSubformer::begin_precise( None, None, return_13 )
let got = the_module::VectorSubformer::begin( None, None, return_13 )
.add( "a" )
.add( "b" )
.form();
Expand All @@ -77,7 +77,7 @@ fn begin_and_custom_end()
13.1
}
}
let got = the_module::VectorSubformer::begin_precise( None, Some( 10.0 ), context_plus_13 )
let got = the_module::VectorSubformer::begin( None, Some( 10.0 ), context_plus_13 )
.add( "a" )
.add( "b" )
.form();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ fn add()
];
a_id!( got, exp );

// with begin_precise
// with begin

let got : HashMap< String, String > = the_module::HashMapSubformer
::begin_precise( Some( hmap![ "a".to_string() => "x".to_string() ] ), Some( () ), former::ReturnStorage )
::begin( Some( hmap![ "a".to_string() => "x".to_string() ] ), Some( () ), former::ReturnStorage )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn add()
// with begin_coercing

let got : HashSet< String > = the_module::HashSetSubformer
::begin_precise( Some( hset![ "a".to_string() ] ), Some( () ), former::ReturnStorage )
::begin( Some( hset![ "a".to_string() ] ), Some( () ), former::ReturnStorage )
.add( "b" )
.form();
let exp = hset!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn add()
// with begin_coercing

let got : Vec< String > = the_module::VectorSubformer
::begin_precise( Some( vec![ "a".to_string() ] ), Some( () ), former::ReturnStorage )
::begin( Some( vec![ "a".to_string() ] ), Some( () ), former::ReturnStorage )
.add( "b" )
.form();
let exp = vec!
Expand Down
8 changes: 4 additions & 4 deletions module/core/former/tests/inc/former_tests/only_test/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ tests_impls!

//

fn begin_precise()
fn begin()
{

// custom params
Expand All @@ -212,7 +212,7 @@ tests_impls!

Struct1FormerDefinition< i32, i32, _ >
>
::begin_precise
::begin
(
None,
Some( 3 ),
Expand All @@ -233,7 +233,7 @@ tests_impls!

Struct1FormerDefinition< i32, i32, former::FormingEndClosure< Struct1FormerDefinitionTypes< i32, i32 > > >
>
::begin_precise
::begin
(
None,
Some( 3 ),
Expand Down Expand Up @@ -551,7 +551,7 @@ tests_index!
former_begin,
custom_definition_params,
begin_coercing,
begin_precise,
begin,
new_coercing,
new,
preform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ tests_impls!
// closure with helper
let got : Struct1 = Struct1Former
::< Struct1FormerDefinition< (), Struct1, _ > >
::begin_precise( None, None, | storage, _context | { former::StoragePreform::preform( storage ) } )
::begin( None, None, | storage, _context | { former::StoragePreform::preform( storage ) } )
.vec_1().replace( vec![ "a".to_string(), "b".to_string() ] ).end()
.form();
let exp : Struct1 = Struct1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tests_impls!
// closure with helper
let got : Struct1 = Struct1Former
::< Struct1FormerDefinition< (), Struct1, _ > >
::begin_precise( None, None, | storage, _context | { former::StoragePreform::preform( storage ) } )
::begin( None, None, | storage, _context | { former::StoragePreform::preform( storage ) } )
.string_slice_1( "abc" )
.form();
let exp = Struct1::former().string_slice_1( "abc" ).form();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ where
}

#[ inline( always ) ]
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 >, on_end : < Definition as former::FormerDefinition >::End, ) -> Self
pub fn begin( 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, ) -> Self
{
if storage.is_none()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ where
}

#[ inline( always ) ]
pub fn begin_precise
pub fn begin
(
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/tests/inc/former_tests/subformer_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ where

let former
: CommandFormer< _, _ >
= CommandFormer::begin_precise( None, Some( self ), on_end );
= CommandFormer::begin( None, Some( self ), on_end );

former.name( name )
}
Expand All @@ -119,7 +119,7 @@ where
where
IntoName : core::convert::Into< String >,
{
let former = CommandFormer::begin_precise( None, Some( self ), AggregatorFormerCommandEnd );
let former = CommandFormer::begin( None, Some( self ), AggregatorFormerCommandEnd );
former.name( name )
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
CommandAsSubformerEnd< K, Self >,
{
let former
= CommandFormer::begin_precise
= CommandFormer::begin
(
None,
Some( self ),
Expand Down
4 changes: 2 additions & 2 deletions module/core/former_meta/src/derive/former.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >
///
// zzz : improve description
#[ inline( always ) ]
pub fn begin_precise
pub fn begin
(
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 @@ -1974,7 +1974,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >
-> Self
{
debug_assert!( storage.is_none() );
Self::begin_precise( None, context, on_end )
Self::begin( None, context, on_end )
}

}
Expand Down

0 comments on commit e286984

Please sign in to comment.