From aa2bb8c5d2f6d5910de203c511d7677884e8f51a Mon Sep 17 00:00:00 2001 From: wandalen Date: Tue, 7 May 2024 17:27:42 +0300 Subject: [PATCH] former : types problem --- .../core/former/examples/former_custom_container.rs | 9 +++++---- module/core/former/tests/inc/mod.rs | 12 ++++++------ module/core/former_meta/src/derive_former/field.rs | 6 ++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/module/core/former/examples/former_custom_container.rs b/module/core/former/examples/former_custom_container.rs index 822be42bb3..275adb25f3 100644 --- a/module/core/former/examples/former_custom_container.rs +++ b/module/core/former/examples/former_custom_container.rs @@ -14,10 +14,10 @@ fn main() // = define custom container // Custom container that logs additions - #[derive(Default)] - pub struct LoggingSet + #[ derive( Default ) ] + pub struct LoggingSet< T > { - set: HashSet, + set : HashSet< T >, } // // Implementing the container traits for LoggingSet @@ -33,7 +33,8 @@ fn main() // } // This trait allows adding entries to the LoggingSet - impl former::ContainerAdd for LoggingSet + impl< T : Eq + std::hash::Hash + fmt::Debug > former::ContainerAdd + for LoggingSet< T > { fn add(&mut self, e: Self::Entry) -> bool { diff --git a/module/core/former/tests/inc/mod.rs b/module/core/former/tests/inc/mod.rs index 5389f2dbec..1b636eaaa0 100644 --- a/module/core/former/tests/inc/mod.rs +++ b/module/core/former/tests/inc/mod.rs @@ -54,12 +54,12 @@ mod former_tests #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] mod parametrized_struct_manual; - // #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] - // mod parametrized_struct_imm; - // #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] - // mod parametrized_struct_where; - // mod parametrized_field; - // mod parametrized_field_where; + #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] + mod parametrized_struct_imm; + #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] + mod parametrized_struct_where; + mod parametrized_field; + mod parametrized_field_where; // #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] // mod subformer_basic; diff --git a/module/core/former_meta/src/derive_former/field.rs b/module/core/former_meta/src/derive_former/field.rs index 6825505048..f554b42c7a 100644 --- a/module/core/former_meta/src/derive_former/field.rs +++ b/module/core/former_meta/src/derive_former/field.rs @@ -706,7 +706,8 @@ where #subformer_definition : former::FormerDefinition < Storage : former::ContainerAdd< Entry = < #typ as former::Container >::Entry >, - Context = Struct1Former< Definition >, + Context = #former< #former_generics_ty >, + // Context = Struct1Former< Definition >, End = #former_assign_end < Definition >, >, { @@ -771,7 +772,8 @@ where #subformer_definition : former::FormerDefinition < Storage : former::ContainerAdd< Entry = < #typ as former::Container >::Entry >, - Context = Struct1Former< Definition >, + Context = #former< #former_generics_ty >, + // Context = Struct1Former< Definition >, End = #former_assign_end < Definition >, >, {