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 30ab77c commit 9a3a30c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
10 changes: 0 additions & 10 deletions module/core/former/src/axiomatic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub trait FormerDefinitionTypes : Sized
type Storage : Default;
type Formed;
type Context;
// type End : FormingEnd< Self >;
}

/// xxx
Expand All @@ -31,15 +30,6 @@ pub trait FormerDefinition : Sized
type End : FormingEnd< Self::Types >;
}

// pub trait FormerDefinitionTypes
// {
// type Storage : StoragePerform< Formed = Self::Formed >;
// type Formed;
// type Context;
// type FormerDefinitionTypes : FormerDefinitionTypes< Storage = Self::Storage, Formed = Self::Formed >;
// type End : FormingEnd< Self::FormerDefinitionTypes, Self::Context >;
// }

/// Defines a handler for the end of a subforming process, enabling the return of the original context.
///
/// This trait is designed to be flexible, allowing for various end-of-forming behaviors in builder patterns.
Expand Down
44 changes: 34 additions & 10 deletions module/core/former/tests/inc/former_tests/container_former_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,23 +197,47 @@ fn custom_definition()
type Context = ();
}

// impl former::FormerDefinition for Return13
// {
// type Types = Return13;
// type End = former::ReturnStorage;
// }

fn return_13( _storage : Vec< String >, _context : Option< () > ) -> i32
impl former::FormerDefinition for Return13
{
13
type Types = Return13;
type End = Return13;
}

let end_wrapper : the_module::FormingEndWrapper< Return13 > = the_module::FormingEndWrapper::new( return_13 );
// -

impl the_module::FormingEnd< Return13 >
for Return13
{
fn call
(
&self,
storage : < Return13 as the_module::FormerDefinitionTypes >::Storage,
context : Option< < Return13 as the_module::FormerDefinitionTypes >::Context >
) -> < Return13 as the_module::FormerDefinitionTypes >::Formed
{
13
}
}

//

// let got = ContainerSubformer::< E, VectorDefinition< E, Context, Formed, End > >
let got = the_module::ContainerSubformer::< String, Return13 >::begin( None, None, Return13 )
.push( "a" )
.push( "b" )
.form();
let exp = 13;
a_id!( got, exp );

//

// // -
//
// fn return_13( _storage : Vec< String >, _context : Option< () > ) -> i32
// {
// 13
// }
//
// let end_wrapper : the_module::FormingEndWrapper< Return13 > = the_module::FormingEndWrapper::new( return_13 );

}

Expand Down

0 comments on commit 9a3a30c

Please sign in to comment.