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 e286984 commit 999034d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#![ allow( dead_code ) ]

use super::*;

// xxx : make it working

/// Parameter description.
// #[ derive( Debug, PartialEq, the_module::Former ) ]
#[ derive( Debug, PartialEq ) ]
pub struct Child< 'child, T >
{
name : String,
is_mandatory : &'child T,
}

// /// 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
// {
// // #[ subform ]
// #[ subform( name = _child ) ]
// #[ container( former::VectorDefinition ) ]
// // #[ setter( false ) ]
// children : Vec< Child >,
// }
//
// impl< Definition > ParentFormer< Definition >
// where
// Definition : former::FormerDefinition,
// Definition::Types : former::FormerDefinitionTypes< Storage = < Parent as former::EntityToStorage >::Storage >,
// {
//
// #[ inline( always ) ]
// pub fn child( self, name : &str ) ->
// ChildAsSubformer< Self, impl ChildAsSubformerEnd< Self > >
// {
// self._children_add_subformer
// ::< ChildFormer< _ >, _, >()
// .name( name )
// }
//
// }

// == begin of generated

// == end of generated

// include!( "./only_test/subformer_subform.rs" );
// include!( "./only_test/subformer_container.rs" );
2 changes: 2 additions & 0 deletions module/core/former/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ mod former_tests

#[ cfg( any( not( feature = "no_std" ) ) ) ]
mod subformer_subform_and_container;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
mod subformer_subform_and_container_parametrized;

}

Expand Down
4 changes: 1 addition & 3 deletions module/core/former_meta/src/derive/former.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,6 @@ fn container_setter

// example : `former::VectorDefinition`
let subformer_definition = &field.attrs.container.as_ref().unwrap().expr;

// xxx
let subformer_definition = if subformer_definition.is_some()
{
qt!
Expand Down Expand Up @@ -1242,7 +1240,7 @@ Result< TokenStream >
Definition::Types : former::FormerDefinitionTypes
<
Storage = < #stru < #struct_generics_ty > as former::EntityToStorage >::Storage,
// xxx : add test with life time + param + containers
// xxx : add test with life time + param + subform
>,
Types2 : former::FormerDefinitionTypes
<
Expand Down

0 comments on commit 999034d

Please sign in to comment.