Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 29, 2024
1 parent dea173a commit b3b9c57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where
where
Definition2 : former::FormerDefinition
<
End = ParentFormerAddChildsEnd< Definition >,
End = ParentFormerAddChildrenEnd< Definition >,
Storage = < Child as former::EntityToStorage >::Storage,
Formed = Self,
Context = Self,
Expand All @@ -89,7 +89,7 @@ where
>,
Former2 : former::FormerBegin< Definition2 >,
{
Former2::former_begin( None, Some( self ), ParentFormerAddChildsEnd::default() )
Former2::former_begin( None, Some( self ), ParentFormerAddChildrenEnd::default() )
}

#[ inline( always ) ]
Expand All @@ -104,13 +104,13 @@ where
}

/// Handles the completion of and element of subformer's container.
pub struct ParentFormerAddChildsEnd< Definition >
pub struct ParentFormerAddChildrenEnd< Definition >
{
_phantom : core::marker::PhantomData< fn( Definition ) >,
}

impl< Definition > Default
for ParentFormerAddChildsEnd< Definition >
for ParentFormerAddChildrenEnd< Definition >
{
#[ inline( always ) ]
fn default() -> Self
Expand All @@ -123,7 +123,7 @@ for ParentFormerAddChildsEnd< Definition >
}

impl< Types2, Definition > former::FormingEnd< Types2, >
for ParentFormerAddChildsEnd< Definition >
for ParentFormerAddChildrenEnd< Definition >
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes
Expand Down Expand Up @@ -489,6 +489,8 @@ where
Self : former::FormingEnd< ParentFormerDefinitionTypes< SuperFormer, SuperFormer >, >,
{}

// = assign

#[ doc = r" Return original former after container for `vec_1` is done." ]
#[ allow( non_camel_case_types ) ]
pub struct ParentFormerAssignChildrenEnd;
Expand Down Expand Up @@ -521,50 +523,6 @@ where
}
}

#[ doc = r" Handles the completion of an element of subformer's container." ]
pub struct ParentFormerAddChildrenEnd< Definition >
{
_phantom : core::marker::PhantomData< fn( Definition ) >,
}

impl< Definition > Default for ParentFormerAddChildrenEnd< Definition >
{
#[ inline( always ) ]
fn default() -> Self
{
Self
{
_phantom : core::marker::PhantomData,
}
}
}

impl< Types2, Definition > former::FormingEnd< Types2, > for ParentFormerAddChildrenEnd< Definition >
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes< Storage = < Parent< > as former::EntityToStorage >::Storage, >,
Types2 : former::FormerDefinitionTypes< Storage = < < Vec< Child > as former::ContainerAdd >::Element as former::EntityToStorage >::Storage, Formed = ParentFormer< Definition, >, Context = ParentFormer< Definition, >, >,
{
#[ inline( always ) ]
fn call(
&self,
substorage : Types2::Storage,
super_former : core::option::Option< Types2::Context >,
) -> Types2::Formed
{
let mut super_former = super_former.unwrap();
if super_former.storage.children.is_none()
{
super_former.storage.children = Some( Default::default() );
}
if let Some( ref mut field ) = super_former.storage.children
{
former::ContainerAdd::add( field, former::StoragePreform::preform( substorage ) );
}
super_former
}
}

// = end of generated for Parent in context of attribute container( former::VectorDefinition ) ]

include!( "./only_test/subformer_subform.rs" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
where
Definition2 : former::FormerDefinition
<
End = ParentFormerAddChildsEnd< Definition >,
End = ParentFormerAddChildrenEnd< Definition >,
Storage = < Child as former::EntityToStorage >::Storage,
Formed = Self,
Context = Self,
Expand All @@ -107,7 +107,7 @@ where
>,
Former2 : former::FormerBegin< Definition2 >,
{
Former2::former_begin( None, Some( self ), ParentFormerAddChildsEnd::default() )
Former2::former_begin( None, Some( self ), ParentFormerAddChildrenEnd::default() )
}

#[ inline( always ) ]
Expand All @@ -122,13 +122,13 @@ where
}

/// Handles the completion of and element of subformer's container.
pub struct ParentFormerAddChildsEnd< Definition >
pub struct ParentFormerAddChildrenEnd< Definition >
{
_phantom : core::marker::PhantomData< fn( Definition ) >,
}

impl< Definition > Default
for ParentFormerAddChildsEnd< Definition >
for ParentFormerAddChildrenEnd< Definition >
{
#[ inline( always ) ]
fn default() -> Self
Expand All @@ -141,7 +141,7 @@ for ParentFormerAddChildsEnd< Definition >
}

impl< Types2, Definition > former::FormingEnd< Types2, >
for ParentFormerAddChildsEnd< Definition >
for ParentFormerAddChildrenEnd< Definition >
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes
Expand Down
4 changes: 2 additions & 2 deletions module/core/former_meta/src/derive/former.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ fn field_subformer_map
// let field_ty = field.non_optional_ty;
// let params = typ::type_parameters( &field.non_optional_ty, .. );

// example : `ParentFormerAddChildsEnd``
// example : `ParentFormerAddChildrenEnd``
let parent_add_element_end_name = format!( "{}FormerAdd{}End", stru, field_ident.to_string().to_case( Case::Pascal ) );
let parent_add_element_end = syn::Ident::new( &parent_add_element_end_name, field_ident.span() );

Expand Down Expand Up @@ -1066,7 +1066,7 @@ Result< TokenStream >
let field_ty = field.non_optional_ty;
// let params = typ::type_parameters( &field.non_optional_ty, .. );

// example : `ParentFormerAddChildsEnd``
// example : `ParentFormerAddChildrenEnd``
let parent_add_element_end_name = format!( "{}FormerAdd{}End", stru, field_ident.to_string().to_case( Case::Pascal ) );
let parent_add_element_end = syn::Ident::new( &parent_add_element_end_name, field_ident.span() );

Expand Down

0 comments on commit b3b9c57

Please sign in to comment.