From 3cf75d0b50f9f53cbdbcadde59db0de287b3e0ef Mon Sep 17 00:00:00 2001 From: wandalen Date: Wed, 27 Mar 2024 23:45:16 +0200 Subject: [PATCH] experimenting --- module/core/former/src/axiomatic.rs | 27 ++++++++++--------- .../inc/former_tests/a_primitives_manual.rs | 4 ++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/module/core/former/src/axiomatic.rs b/module/core/former/src/axiomatic.rs index e6da43dd8e..8c70343deb 100644 --- a/module/core/former/src/axiomatic.rs +++ b/module/core/former/src/axiomatic.rs @@ -1,5 +1,5 @@ -//! .... +/// xxx pub trait Storage : ::core::default::Default { // type Types : FormerDefinitionTypes< Storage = Self >; @@ -21,6 +21,9 @@ pub trait FormerDefinitionTypes : Sized type Storage : Default; type Formed; type Context; + + // fn preform( storage : Self::Storage, context : Self::Context ) -> Self::Formed; + } /// xxx @@ -66,23 +69,23 @@ where } } -// /// A `FormingEnd` implementation that returns the formed container itself instead of the context. -// /// -// /// This struct is useful when the forming process should result in the formed container being returned directly, -// /// bypassing any additional context processing. It simplifies scenarios where the formed container is the final result. -// #[ derive( Debug, Default ) ] -// pub struct ReturnFormed; -// +/// A `FormingEnd` implementation that returns the formed container itself instead of the context. +/// +/// This struct is useful when the forming process should result in the formed container being returned directly, +/// bypassing any additional context processing. It simplifies scenarios where the formed container is the final result. +#[ derive( Debug, Default ) ] +pub struct ReturnFormed; + // impl< Definition > FormingEnd< Definition > // for ReturnFormed // where -// Definition::Storage : StoragePerform< Formed = Definition::Formed >, -// Definition : FormerDefinitionTypes< Context = () >, +// // Definition::Storage : StoragePerform< Formed = Definition::Formed >, +// Definition : FormerDefinitionTypes< Definition::Context >, // { // #[ inline( always ) ] -// fn call( &self, storage : Definition::Storage, _context : core::option::Option< () > ) -> Definition::Formed +// fn call( &self, storage : Definition::Storage, context : core::option::Option< Context > ) -> Definition::Formed // { -// storage.preform() +// storage.preform( context ) // } // } diff --git a/module/core/former/tests/inc/former_tests/a_primitives_manual.rs b/module/core/former/tests/inc/former_tests/a_primitives_manual.rs index 2ae6d728fa..5a9321884b 100644 --- a/module/core/former/tests/inc/former_tests/a_primitives_manual.rs +++ b/module/core/former/tests/inc/former_tests/a_primitives_manual.rs @@ -39,6 +39,7 @@ for Struct1FormerDefinition { type Storage = Struct1FormerStorage; type Formed = Struct1; + type End = former::ReturnFormed; } // = storage @@ -72,7 +73,8 @@ impl Default for Struct1FormerStorage impl former::Storage for Struct1FormerStorage { - type Types = Struct1FormerDefinition; + // type Types = Struct1FormerDefinition; + type Formed = Struct1; } impl former::StoragePerform