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 cbcdf7f commit d83a1db
Show file tree
Hide file tree
Showing 12 changed files with 446 additions and 663 deletions.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ tests_impls!
{

// Container subformers are defined
let _got = Struct1FormerAssignVec1End;
let _got = Struct1FormerAssignHashmap1End;
let _got = Struct1FormerAssignHashset1End;
let _got = Struct1FormerAssignVec1End::< Struct1FormerDefinition >::default();
let _got = Struct1FormerAssignHashmap1End::< Struct1FormerDefinition >::default();
let _got = Struct1FormerAssignHashset1End::< Struct1FormerDefinition >::default();

// SubformerEnd is defined
fn _f1< End : Struct1SubformerEnd< Struct1Former > >
// AsSubformerEnd is defined
fn _f1< End : Struct1AsSubformerEnd< Struct1Former > >
(
_end : End,
_subformer : Struct1Subformer< Struct1Former, impl Struct1SubformerEnd< Struct1Former > >
_subformer : Struct1AsSubformer< Struct1Former, impl Struct1AsSubformerEnd< Struct1Former > >
)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ fn child()
let got = Parent::former()
.child( "a" ).end()
.child( "b" ).end()
// .add( Child::former().name( "a" ).form() )
// .add( Child::former().name( "b" ).form() )
// .end()
.form();

let children = vec!
Expand Down
10 changes: 5 additions & 5 deletions module/core/former/tests/inc/former_tests/subformer_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ where

// // = command subformer - generated
//
// pub type CommandSubformer< K, Superformer, End > = CommandFormer
// pub type CommandAsSubformer< K, Superformer, End > = CommandFormer
// <
// K,
// CommandFormerDefinition
Expand All @@ -29,7 +29,7 @@ where
//
// // = command subformer end - generated
//
// pub trait CommandSubformerEnd< K, SuperFormer >
// pub trait CommandAsSubformerEnd< K, SuperFormer >
// where
// K : core::hash::Hash + std::cmp::Eq,
// Self : the_module::FormingEnd
Expand All @@ -39,7 +39,7 @@ where
// {
// }
//
// impl< K, SuperFormer, T > CommandSubformerEnd< K, SuperFormer >
// impl< K, SuperFormer, T > CommandAsSubformerEnd< K, SuperFormer >
// for T
// where
// K : core::hash::Hash + std::cmp::Eq,
Expand Down Expand Up @@ -81,7 +81,7 @@ where
#[ inline( always ) ]
pub fn command_with_closure< IntoName >( self, name : IntoName )
->
CommandSubformer< K, Self, impl CommandSubformerEnd< K, Self > >
CommandAsSubformer< K, Self, impl CommandAsSubformerEnd< K, Self > >
where
IntoName : core::convert::Into< String >,
{
Expand Down Expand Up @@ -115,7 +115,7 @@ where
#[ inline( always ) ]
pub fn command_with_type< IntoName >( self, name : IntoName )
->
CommandSubformer< K, Self, impl CommandSubformerEnd< K, Self > >
CommandAsSubformer< K, Self, impl CommandAsSubformerEnd< K, Self > >
where
IntoName : core::convert::Into< String >,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where
#[ inline( always ) ]
pub fn command_with_helper< IntoName >( self, name : IntoName )
->
CommandSubformer< K, Self, impl CommandSubformerEnd< K, Self > >
CommandAsSubformer< K, Self, impl CommandAsSubformerEnd< K, Self > >
where
IntoName : core::convert::Into< String >,
ContainerAddElement
Expand All @@ -52,7 +52,7 @@ where
Command< K >
>
:
CommandSubformerEnd< K, Self >,
CommandAsSubformerEnd< K, Self >,
{
let former
= CommandFormer::begin_precise
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#![ allow( dead_code ) ]

use super::*;

/// Parameter description.
#[ derive( Debug, Default, PartialEq, the_module::Former ) ]
pub struct Child
{
name : String,
is_mandatory : bool,
}

/// Parent required for the template.
#[ derive( Debug, Default, PartialEq, the_module::Former ) ]
// #[ derive( Debug, Default, PartialEq, the_module::Former ) ] #[ debug ]
// #[ derive( Debug, Default, PartialEq ) ]
pub struct Parent
{
#[ container( former::VectorDefinition ) ]
#[ subform( name : child ) ]
// #[ setter( false ) ]
children : Vec< Child >,
}

//

// xxx
// include!( "./only_test/subformer_subform.rs" );
include!( "./only_test/subformer_container.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use super::*;

// xxx : rename
/// Parameter description.
#[ derive( Debug, Default, PartialEq, the_module::Former ) ]
pub struct Child
Expand Down Expand Up @@ -95,7 +94,7 @@ where

#[ inline( always ) ]
pub fn child( self, name : &str ) ->
ChildSubformer< Self, impl ChildSubformerEnd< Self > >
ChildAsSubformer< Self, impl ChildAsSubformerEnd< Self > >
{
self._children_element_subformer
::< ChildFormer< _ >, _, >()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
{

#[ inline( always ) ]
pub fn child( self, name : &str ) -> ChildSubformer< Self, impl ChildSubformerEnd< Self > >
pub fn child( self, name : &str ) -> ChildAsSubformer< Self, impl ChildAsSubformerEnd< Self > >
{
self._children_element_subformer::< ChildFormer< _ >, _, >()
.name( name )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ where

#[ inline( always ) ]
pub fn child( self, name : &str ) ->
ChildSubformer< Self, impl ChildSubformerEnd< Self > >
ChildAsSubformer< Self, impl ChildAsSubformerEnd< Self > >
{
self._children_element_subformer
::< ChildFormer< _ >, _, >()
Expand Down
9 changes: 3 additions & 6 deletions module/core/former/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ mod former_tests
mod a_containers_with_subformer_manual;
#[ cfg( not( feature = "no_std" ) ) ]
mod a_containers_with_subformer;
#[ cfg( not( feature = "no_std" ) ) ]
mod a_containers_with_subformer_implicit;

mod attribute_default_container;
mod attribute_default_primitive;
Expand Down Expand Up @@ -70,10 +68,9 @@ mod former_tests
mod subformer_subform_manual;

#[ cfg( any( not( feature = "no_std" ) ) ) ]
mod subformer_subform_implicit_container;
// #[ cfg( any( not( feature = "no_std" ) ) ) ]
// mod subformer_subform_implicit_container_manutal;
// xxx
mod subformer_implicit_container;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
mod subformer_implicit_container_manual;

}

Expand Down
Loading

0 comments on commit d83a1db

Please sign in to comment.