Skip to content

Commit

Permalink
experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 26, 2024
1 parent 16bd87f commit 4003634
Showing 1 changed file with 67 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ fn begin_and_custom_end()
fn custom_definition()
{

// xxx2 : continue
// xxx : make example of that

struct Return13;
impl former::FormerDefinitionTypes for Return13
{
Expand Down Expand Up @@ -219,6 +220,8 @@ fn custom_definition()
}
}

// type MyContainer<>

//

let got = the_module::ContainerSubformer::< String, Return13 >::begin( None, None, Return13 )
Expand All @@ -230,6 +233,69 @@ fn custom_definition()

//

}

//

#[ test ]
fn custom_definition_parametrized()
{

// xxx : make example of that

// xxx2 : continue
struct Return13< E >( ::core::marker::PhantomData< E > );

impl< E > Return13< E >
{
pub fn new() -> Self
{
Self ( ::core::marker::PhantomData )
}
}

impl< E > former::FormerDefinitionTypes for Return13< E >
{
type Storage = Vec< E >;
type Formed = i32;
type Context = ();
}

impl< E > former::FormerDefinition for Return13< E >
{
type Types = Return13< E >;
type End = Return13< E >;
}

// -

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

// type MyContainer< Type >

//

let got = the_module::ContainerSubformer::< String, Return13< String > >::begin( None, None, Return13::new() )
.push( "a" )
.push( "b" )
.form();
let exp = 13;
a_id!( got, exp );

//

// xxx : make it working?
// let got = the_module::ContainerSubformer::< String, Return13 >::new()
// .push( "a" )
Expand Down

0 comments on commit 4003634

Please sign in to comment.