diff --git a/module/core/former/tests/inc/former_tests/subformer_shortcut.rs b/module/core/former/tests/inc/former_tests/subformer_shortcut.rs index 6f32e8f670..c1d67a0e6b 100644 --- a/module/core/former/tests/inc/former_tests/subformer_shortcut.rs +++ b/module/core/former/tests/inc/former_tests/subformer_shortcut.rs @@ -80,21 +80,21 @@ 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 @@ -102,7 +102,7 @@ where pub fn descriptor( self, name : &str ) -> TemplateParameterDescriptorSubformer< Self, impl TemplateParameterDescriptorSubformerEnd< Self > > { - self._descriptor_former2 + self._descriptor_former :: < TemplateParameterDescriptorFormer< _ >, @@ -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 > { @@ -139,7 +166,8 @@ where Definition : former::FormerDefinition, Definition::Types : former::FormerDefinitionTypes < - Storage = TemplateParametersFormerStorage + Storage = TemplateParametersFormerStorage, + // Storage = Storage, >, Types2 : former::FormerDefinitionTypes <