From 58445e6bb8f8cc72f4c90aae55170c8f14aafad3 Mon Sep 17 00:00:00 2001 From: wandalen Date: Tue, 7 May 2024 13:08:19 +0300 Subject: [PATCH] former : solve problem with container interface --- module/core/former/src/hash_map.rs | 3 +++ module/core/former/src/hash_set.rs | 3 +++ .../a_containers_with_subformer_manual.rs | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/module/core/former/src/hash_map.rs b/module/core/former/src/hash_map.rs index 079ffb3bea..501ce13caa 100644 --- a/module/core/former/src/hash_map.rs +++ b/module/core/former/src/hash_map.rs @@ -109,6 +109,9 @@ where #[ derive( Debug, Default ) ] pub struct HashMapDefinition< K, E, Context = (), Formed = HashMap< K, E >, End = ReturnStorage > +where + K : ::core::cmp::Eq + ::core::hash::Hash, + End : FormingEnd< HashMapDefinitionTypes< K, E, Context, Formed > >, { _phantom : core::marker::PhantomData< ( K, E, Context, Formed, End ) >, } diff --git a/module/core/former/src/hash_set.rs b/module/core/former/src/hash_set.rs index a8524adf41..a73dbc7194 100644 --- a/module/core/former/src/hash_set.rs +++ b/module/core/former/src/hash_set.rs @@ -117,6 +117,9 @@ where #[ derive( Debug, Default ) ] pub struct HashSetDefinition< K, Context = (), Formed = HashSet< K >, End = ReturnStorage > +where + End : FormingEnd< HashSetDefinitionTypes< K, Context, Formed > >, + K : ::core::cmp::Eq + ::core::hash::Hash, { _phantom : core::marker::PhantomData< ( K, Context, Formed, End ) >, } diff --git a/module/core/former/tests/inc/former_tests/a_containers_with_subformer_manual.rs b/module/core/former/tests/inc/former_tests/a_containers_with_subformer_manual.rs index a835d62c59..7134a721b5 100644 --- a/module/core/former/tests/inc/former_tests/a_containers_with_subformer_manual.rs +++ b/module/core/former/tests/inc/former_tests/a_containers_with_subformer_manual.rs @@ -441,6 +441,10 @@ where Context = Struct1Former< Definition >, End = Struct1FormerAssignHashmap1End< Definition >, >, + Struct1FormerAssignHashmap1End< Definition > : former::FormingEnd + < + < collection_tools::HashMap< String, String > as former::EntityToDefinitionTypes< Self, Self > >::Types + >, { Former2::former_begin( None, Some( self ), Struct1FormerAssignHashmap1End::< Definition >::default() ) } @@ -458,6 +462,10 @@ where Context = Struct1Former< Definition >, End = Struct1FormerAssignHashmap1End< Definition >, >, + Struct1FormerAssignHashmap1End< Definition > : former::FormingEnd + < + < collection_tools::HashMap< String, String > as former::EntityToDefinitionTypes< Self, Self > >::Types + >, { self._hashmap_1_assign::< former::ContainerSubformer:: < @@ -481,6 +489,11 @@ where Context = Struct1Former< Definition >, End = Struct1FormerAssignHashset1End< Definition >, >, + Struct1FormerAssignHashset1End< Definition > : former::FormingEnd + < + < collection_tools::HashSet< String > as former::EntityToDefinitionTypes< Self, Self > >::Types + >, + // Struct1FormerAssignHashset1End< Definition > : former::FormingEnd // < // former::HashSetDefinitionTypes< String, Struct1Former< Definition >, Struct1Former< Definition > > @@ -502,6 +515,11 @@ where Context = Struct1Former< Definition >, End = Struct1FormerAssignHashset1End< Definition >, >, + Struct1FormerAssignHashset1End< Definition > : former::FormingEnd + < + < collection_tools::HashSet< String > as former::EntityToDefinitionTypes< Self, Self > >::Types + >, + // Struct1FormerAssignHashset1End< Definition > : former::FormingEnd // < // former::HashSetDefinitionTypes< String, Struct1Former< Definition >, Struct1Former< Definition > >,