Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 23, 2024
1 parent aa8d15c commit 05d19cc
Showing 1 changed file with 45 additions and 17 deletions.
62 changes: 45 additions & 17 deletions module/core/former/tests/inc/former_tests/subformer_shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,29 @@ where
// Former2::_begin( None, Some( self ), on_end )
}

#[ inline( always ) ]
pub fn _descriptor_former2< Former2, Definition2, Types2 >( self ) ->
Former2
where
Types2 : former::FormerDefinitionTypes
<
Storage = TemplateParameterDescriptorFormerStorage,
Formed = Self,
Context = Self,
>,
Definition2 : former::FormerDefinition< Types = Types2, End = TemplateParameterDescriptorEnd< Definition, Types2 > >,
Former2 : former::FormerBegin< Definition2 >,
{
Former2::_begin( None, Some( self ), TemplateParameterDescriptorEnd::< Definition, Types2 >::default() )
}
// #[ inline( always ) ]
// pub fn _descriptor_former2< Former2, Definition2, Types2 >( self ) ->
// Former2
// where
// Types2 : former::FormerDefinitionTypes
// <
// Storage = TemplateParameterDescriptorFormerStorage,
// Formed = Self,
// Context = Self,
// >,
// Definition2 : former::FormerDefinition< Types = Types2, End = TemplateParameterDescriptorEnd< Definition, Types2 > >,
// Former2 : former::FormerBegin< Definition2 >,
// {
// Former2::_begin( None, Some( self ), TemplateParameterDescriptorEnd::default() )
// }

// xxx2 : move to a trait and make easier to use subformer, trait with generic interface of a container should help

#[ inline( always ) ]
pub fn descriptor( self, name : &str ) ->
TemplateParameterDescriptorSubformer< Self, impl TemplateParameterDescriptorSubformerEnd< Self > >
{
self._descriptor_former2
self._descriptor_former
::
<
TemplateParameterDescriptorFormer< _ >,
Expand All @@ -114,6 +114,33 @@ where
}
}

trait SubFormerTrait< Definition, Definition2, Types2 >
where
Types2 : former::FormerDefinitionTypes
<
Storage = TemplateParameterDescriptorFormerStorage,
Formed = Self,
Context = Self,
>,
Definition2 : former::FormerDefinition< Types = Types2, End = TemplateParameterDescriptorEnd< Definition, Types2 > >,
Self : former::FormerBegin< Definition2 >,
{
}

impl< T, Definition, Definition2, Types2 > SubFormerTrait< Definition, Definition2, Types2 >
for T
where
Types2 : former::FormerDefinitionTypes
<
Storage = TemplateParameterDescriptorFormerStorage,
Formed = Self,
Context = Self,
>,
Definition2 : former::FormerDefinition< Types = Types2, End = TemplateParameterDescriptorEnd< Definition, Types2 > >,
Self : former::FormerBegin< Definition2 >,
{
}

/// Handles the completion of the subformer for `TemplateParameterDescriptor`.
pub struct TemplateParameterDescriptorEnd< Definition, Types2 >
{
Expand All @@ -139,7 +166,8 @@ where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes
<
Storage = TemplateParametersFormerStorage
Storage = TemplateParametersFormerStorage,
// Storage = Storage,
>,
Types2 : former::FormerDefinitionTypes
<
Expand Down

0 comments on commit 05d19cc

Please sign in to comment.