Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 24, 2024
1 parent 98995c6 commit 2d9841e
Showing 1 changed file with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions module/core/former/tests/inc/former_tests/container_former_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,33 +140,61 @@ fn replace()
//

#[ test ]
fn custom_end()
fn begin_and_custom_end()
{

// xxx2 : continue
struct Return13;
impl former::FormerDefinition for Return13
{
type Storage = Vec< String >;
type Formed = i32;
type Context = ();
}
// struct Return13;
// impl former::FormerDefinition for Return13
// {
// type Storage = Vec< String >;
// type Formed = i32;
// type Context = ();
// }
//
// fn return_13( _storage : Vec< String >, _context : Option< () > ) -> i32
// {
// 13
// }
//
// let end_wrapper : the_module::FormingEndWrapper< Return13 > = the_module::FormingEndWrapper::new( return_13 );

fn return_13( _storage : Vec< String >, _context : Option< () > ) -> i32
// xxx : make example with that

// basic case

fn return_13( _storage : Vec< String >, context : Option< () > ) -> f32
{
13
13.1
}
let got = the_module::VectorSubformer::begin( None, None, return_13 )
.push( "a" )
.push( "b" )
.form();
let exp = 13.1;
a_id!( got, exp );

let end_wrapper : the_module::FormingEndWrapper< Return13 > = the_module::FormingEndWrapper::new( return_13 );
// with a context

let got : i32 = the_module::VectorSubformer::< String, (), i32, _ >::begin( None, None, return_13 )
fn context_plus_13( _storage : Vec< String >, context : Option< f32 > ) -> f32
{
if let Some( context ) = context
{
13.1 + context
}
else
{
13.1
}
}
let got = the_module::VectorSubformer::begin( None, Some( 10.0 ), context_plus_13 )
.push( "a" )
.push( "b" )
.form();
// let exp = 13;
// a_id!( got, exp );
let exp = 23.1;
a_id!( got, exp );

// pub type VectorSubformer< E, Context, End > = ContainerSubformer::< E, VectorDefinition< E, Context, End > >;
//

}

Expand Down

0 comments on commit 2d9841e

Please sign in to comment.