From 21829bb4e80a1ef02d48c6b4951ee943b7aa526c Mon Sep 17 00:00:00 2001 From: wandalen Date: Sun, 12 May 2024 01:15:29 +0300 Subject: [PATCH] former : cleaning --- module/core/former_meta/src/derive_former.rs | 1 + .../core/former_meta/src/derive_former/field.rs | 17 ++++++++++++++++- module/move/wca/src/ca/aggregator.rs | 3 ++- module/move/wca/src/ca/grammar/command.rs | 5 +++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/module/core/former_meta/src/derive_former.rs b/module/core/former_meta/src/derive_former.rs index dac0eb6e8a..92beeefef0 100644 --- a/module/core/former_meta/src/derive_former.rs +++ b/module/core/former_meta/src/derive_former.rs @@ -655,6 +655,7 @@ specific needs of the broader forming context. It mandates the implementation of #former_generics_where { + /// Executes the transformation from the former's storage state to the preformed object as specified by the definition. pub fn preform( self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed { former::StoragePreform::preform( self.storage ) diff --git a/module/core/former_meta/src/derive_former/field.rs b/module/core/former_meta/src/derive_former/field.rs index cba88da221..a38cdead95 100644 --- a/module/core/former_meta/src/derive_former/field.rs +++ b/module/core/former_meta/src/derive_former/field.rs @@ -488,10 +488,26 @@ allowing for dynamic and flexible construction of the `{stru}` entity's {field_i let setters_code = if attr.setter() { + + let doc = format! + ( + r#" +Provides a user-friendly interface to add an instancce of {field_ident} to the {stru}. + +# Returns + +Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities, +allowing for dynamic and flexible construction of the `{stru}` entity's {field_ident}. + + "#, + format!( "{}", qt!{ #field_typ } ), + ); + qt! { #setters_code + #[ doc = #doc ] #[ inline( always ) ] pub fn #setter_name( self ) -> < < #field_typ as former::Container >::Val as former::EntityToFormer @@ -908,7 +924,6 @@ with the new content generated during the subforming process. } else { - qt! { < diff --git a/module/move/wca/src/ca/aggregator.rs b/module/move/wca/src/ca/aggregator.rs index 197c1ff6e4..1174de448f 100644 --- a/module/move/wca/src/ca/aggregator.rs +++ b/module/move/wca/src/ca/aggregator.rs @@ -102,6 +102,7 @@ pub( crate ) mod private #[ derive( former::Former ) ] #[ storage_fields( help_generator : HelpGeneratorFn, help_variants : HashSet< HelpVariants > ) ] #[ mutator( custom = true ) ] + // #[ debug ] pub struct CommandsAggregator { #[ former( default = Dictionary::default() ) ] @@ -119,7 +120,7 @@ pub( crate ) mod private callback_fn : Option< CommandsAggregatorCallback >, } - + impl< Context, Formed > former::FormerMutator for CommandsAggregatorFormerDefinitionTypes< Context, Formed > { fn form_mutation( storage : &mut Self::Storage, _context : &mut Option< Self::Context > ) diff --git a/module/move/wca/src/ca/grammar/command.rs b/module/move/wca/src/ca/grammar/command.rs index 93648eda09..2f12e03921 100644 --- a/module/move/wca/src/ca/grammar/command.rs +++ b/module/move/wca/src/ca/grammar/command.rs @@ -44,7 +44,7 @@ pub( crate ) mod private /// subject optional parameter #[ former( default = false ) ] optional : bool, - #[ scalar( setter = false, hint = false ) ] + #[ scalar( setter = false ) ] #[ former( default = Vec::new() ) ] properties_aliases : Vec< String >, } @@ -86,6 +86,7 @@ pub( crate ) mod private #[ derive( Debug, Clone, PartialEq, Eq ) ] #[ derive( Former ) ] + // #[ debug ] pub struct Command { /// Command common hint. @@ -106,7 +107,7 @@ pub( crate ) mod private // aaa : here it is // qqq : make it usable and remove default(?) /// The type `Routine` represents the specific implementation of the routine. - #[ scalar( setter = false, hint = false ) ] + #[ scalar( setter = false ) ] #[ former( default = Routine::from( Handler::from( || { panic!( "No routine available: A handler function for the command is missing" ) } ) ) ) ] pub routine : Routine, }