diff --git a/module/core/former/tests/inc/former_tests/tuple_struct.rs b/module/core/former/tests/inc/former_tests/tuple_struct.rs new file mode 100644 index 0000000000..57f13ec1d6 --- /dev/null +++ b/module/core/former/tests/inc/former_tests/tuple_struct.rs @@ -0,0 +1,35 @@ +#![ deny( missing_docs ) ] + +#[ allow( unused_imports ) ] +use super::*; + +use collection_tools::HashMap; + +type Key = &'static str; +type Value = &'static str; + +#[ derive( Debug, PartialEq, former::Former ) ] +pub struct Struct1( #[ subform_collection ] HashMap< Key, Value > ); + +impl Struct1 +{ + pub fn get( &self, key : Key ) -> Option< &Value > + { + self.0.get( key ) + } +} + +#[ test ] +fn example() +{ + // form a key-value store + let instance = Struct1::former() + .map() + .add( ( "first", "Value1" ) ) + .add( ( "second", "Value2" ) ) + .end() + .form(); + + // now it is a read-only storage with pre-configured data + assert_eq!( Some( &"Value1" ), instance.get( "first" ) ); +} diff --git a/module/core/former/tests/inc/mod.rs b/module/core/former/tests/inc/mod.rs index 5348cbcae6..a4351febf9 100644 --- a/module/core/former/tests/inc/mod.rs +++ b/module/core/former/tests/inc/mod.rs @@ -17,6 +17,7 @@ mod former_tests mod a_basic; mod a_primitives_manual; mod a_primitives; + mod tuple_struct; #[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] mod subform_collection_basic_scalar; diff --git a/module/move/wca/src/ca/executor/routine.rs b/module/move/wca/src/ca/executor/routine.rs index 146a290639..9165c4486a 100644 --- a/module/move/wca/src/ca/executor/routine.rs +++ b/module/move/wca/src/ca/executor/routine.rs @@ -126,7 +126,7 @@ pub( crate ) mod private } } - // qqq : make 0-arguments, 1-argument, 2-arguments, 3 arguments versions + // aaa : make 0-arguments, 1-argument, 2-arguments, 3 arguments versions // aaa : done. now it works with the following variants: // fn(), fn(args), fn(props), fn(args, props), fn(context), fn(context, args), fn(context, props), fn(context, args, props) @@ -297,7 +297,7 @@ pub( crate ) mod private } } - // qqq : why Rc is necessary? why not just box? + // aaa : why Rc is necessary? why not just box? // aaa : to be able to clone Routines impl PartialEq for Routine diff --git a/module/move/wca/src/ca/grammar/command.rs b/module/move/wca/src/ca/grammar/command.rs index a582aeee91..54274df86d 100644 --- a/module/move/wca/src/ca/grammar/command.rs +++ b/module/move/wca/src/ca/grammar/command.rs @@ -36,6 +36,7 @@ pub( crate ) mod private { name : String, // qqq : how to re-use ValueDescriptionFormer without additional end? + // #[subform_scalar] // value : ValueDescription, /// providing guidance to the user for entering a valid value hint : String, @@ -103,7 +104,7 @@ pub( crate ) mod private /// Map of aliases. // Aliased key -> Original key pub properties_aliases : HashMap< String, String >, - // qqq : for Bohdan : routine should also be here + // aaa : for Bohdan : routine should also be here // aaa : here it is // qqq : make it usable and remove default(?) /// The type `Routine` represents the specific implementation of the routine. diff --git a/module/move/wca/src/ca/parser/command.rs b/module/move/wca/src/ca/parser/command.rs index 1d39e9bf34..116142c709 100644 --- a/module/move/wca/src/ca/parser/command.rs +++ b/module/move/wca/src/ca/parser/command.rs @@ -7,9 +7,10 @@ pub( crate ) mod private /// A `Program` consists of one or more commannd /// /// The program can be executed by iterating over each commands and executing it - // qqq : xxx : for Bohdan : Commands should be here instead of Namespace - // qqq : remove concept Namespace - // qqq : introduce concept Dictionary for grammar + // aaa : xxx : for Bohdan : Commands should be here instead of Namespace + // aaa : remove concept Namespace + // aaa : introduce concept Dictionary for grammar + // aaa : done #[ derive( Debug, Clone, PartialEq, Eq ) ] pub struct Program< Command > { diff --git a/module/move/willbe/src/action/readme_modules_headers_renew.rs b/module/move/willbe/src/action/readme_modules_headers_renew.rs index 731cdf0b06..ea07a48c99 100644 --- a/module/move/willbe/src/action/readme_modules_headers_renew.rs +++ b/module/move/willbe/src/action/readme_modules_headers_renew.rs @@ -78,7 +78,7 @@ mod private let repo_url = url::extract_repo_url( &self.repository_url ).and_then( | r | url::git_info_extract( &r ).ok() ).ok_or_else::< Error, _ >( || err!( "Fail to parse repository url" ) )?; let example = if let Some( name ) = find_example_file( self.module_path.as_path(), &self.module_name ) { - // qqq : for Bohdan : Hardcoded Strings, would be better to use `PathBuf` to avoid separator mismatch on Windows and Unix + // qqq : for Petro : Hardcoded Strings, would be better to use `PathBuf` to avoid separator mismatch on Windows and Unix let p = name.strip_prefix( workspace_path ).unwrap().get( 1.. ).unwrap().replace( "\\","%2F" ); let name = name.replace( "/", "\\" ); let name = name.split( "\\" ).last().unwrap().split( "." ).next().unwrap(); diff --git a/module/move/willbe/src/command/list.rs b/module/move/willbe/src/command/list.rs index 9c970783f9..154317904c 100644 --- a/module/move/willbe/src/command/list.rs +++ b/module/move/willbe/src/command/list.rs @@ -19,9 +19,8 @@ mod private use action::{ list as l, list::{ ListFormat, ListOptions } }; use former::Former; - // qqq: `Former` forces the struct to be public #[ derive( Former ) ] - pub struct ListProperties + struct ListProperties { #[ former( default = ListFormat::Tree ) ] format : ListFormat, diff --git a/module/move/willbe/src/command/mod.rs b/module/move/willbe/src/command/mod.rs index 05ea6c3d3e..7fc98cf913 100644 --- a/module/move/willbe/src/command/mod.rs +++ b/module/move/willbe/src/command/mod.rs @@ -196,7 +196,6 @@ with_gitpod: If set to 1, a column with a link to Gitpod will be added. Clicking .routine( command::test ) .end() - // qqq : is it right? .command( "cicd.renew" ) .hint( "generate a CI/CD for the workspace" ) .long_hint( "this command generates a development workflow for the entire workspace inferred from the current directory. The workflow outlines the build steps, dependencies, test processes, and more for all modules within the workspace." ) diff --git a/module/move/willbe/src/command/publish.rs b/module/move/willbe/src/command/publish.rs index 2724b33b78..9b1d09eff0 100644 --- a/module/move/willbe/src/command/publish.rs +++ b/module/move/willbe/src/command/publish.rs @@ -9,9 +9,8 @@ mod private use former::Former; use std::fmt::Write; - // qqq: `Former` forces the struct to be public #[ derive( Former ) ] - pub struct PublishProperties + struct PublishProperties { #[ former( default = true ) ] dry : bool, diff --git a/module/move/willbe/src/command/publish_diff.rs b/module/move/willbe/src/command/publish_diff.rs index cbb029393e..961ba818c4 100644 --- a/module/move/willbe/src/command/publish_diff.rs +++ b/module/move/willbe/src/command/publish_diff.rs @@ -8,9 +8,8 @@ mod private use wtools::error::Result; use _path::AbsolutePath; - // qqq: `Former` forces the struct to be public #[ derive( former::Former ) ] - pub struct PublishDiffProperties + struct PublishDiffProperties { keep_archive : Option< PathBuf >, } diff --git a/module/move/willbe/src/command/test.rs b/module/move/willbe/src/command/test.rs index e97ff16b5f..25019344fb 100644 --- a/module/move/willbe/src/command/test.rs +++ b/module/move/willbe/src/command/test.rs @@ -15,9 +15,8 @@ mod private use error_tools::for_app::bail; use optimization::Optimization; - // qqq: `Former` forces the struct to be public #[ derive( Former, Debug ) ] - pub struct TestsProperties + struct TestsProperties { #[ former( default = true ) ] dry : bool, diff --git a/module/move/willbe/src/command/workspace_renew.rs b/module/move/willbe/src/command/workspace_renew.rs index 4307e20045..26cc520bf4 100644 --- a/module/move/willbe/src/command/workspace_renew.rs +++ b/module/move/willbe/src/command/workspace_renew.rs @@ -7,9 +7,8 @@ mod private use wtools::error::{ anyhow::Context, Result }; use action::WorkspaceTemplate; - // qqq: `Former` forces the struct to be public #[ derive( Former ) ] - pub struct WorkspaceNewProperties + struct WorkspaceNewProperties { repository_url : String, branches : Vec< String >, diff --git a/module/move/willbe/src/entity/package.rs b/module/move/willbe/src/entity/package.rs index 3a99fe17fc..379e8a2bfd 100644 --- a/module/move/willbe/src/entity/package.rs +++ b/module/move/willbe/src/entity/package.rs @@ -317,7 +317,7 @@ mod private } #[ derive( Debug, Clone ) ] - pub struct GitThingsOptions + pub struct GitOptions { pub git_root : AbsolutePath, pub items : Vec< AbsolutePath >, @@ -325,7 +325,7 @@ mod private pub dry : bool, } - fn perform_git_commit( o : GitThingsOptions ) -> Result< ExtendedGitReport > + fn perform_git_commit( o : GitOptions ) -> Result< ExtendedGitReport > { let mut report = ExtendedGitReport::default(); if o.items.is_empty() { return Ok( report ); } @@ -352,8 +352,7 @@ mod private pub package_name : String, pub pack : cargo::PackOptions, pub version_bump : version::BumpOptions, - // qqq : rename - pub git_things : GitThingsOptions, + pub git_options : GitOptions, pub publish : cargo::PublishOptions, pub dry : bool, } @@ -396,7 +395,7 @@ mod private dependencies : dependencies.clone(), dry : self.dry, }; - let git_things = GitThingsOptions + let git_options = GitOptions { git_root : workspace_root, items : dependencies.iter().chain([ &crate_dir ]).map( | d | d.absolute_path().join( "Cargo.toml" ) ).collect(), @@ -416,7 +415,7 @@ mod private package_name : self.package.name().unwrap(), pack, version_bump, - git_things, + git_options, publish, dry : self.dry, } @@ -440,13 +439,13 @@ mod private package_name: _, mut pack, mut version_bump, - mut git_things, + mut git_options, mut publish, dry, } = instruction; pack.dry = dry; version_bump.dry = dry; - git_things.dry = dry; + git_options.dry = dry; publish.dry = dry; report.get_info = Some( cargo::pack( pack ).map_err( | e | ( report.clone(), e ) )? ); @@ -454,8 +453,8 @@ mod private report.publish_required = true; let bump_report = version::version_bump( version_bump ).map_err( | e | ( report.clone(), e ) )?; report.bump = Some( bump_report.clone() ); - let git_root = git_things.git_root.clone(); - let git = match perform_git_commit( git_things ) + let git_root = git_options.git_root.clone(); + let git = match perform_git_commit( git_options ) { Ok( git ) => git, Err( e ) => diff --git a/module/move/willbe/src/entity/test.rs b/module/move/willbe/src/entity/test.rs index 7735bc5af1..23350320f5 100644 --- a/module/move/willbe/src/entity/test.rs +++ b/module/move/willbe/src/entity/test.rs @@ -440,7 +440,7 @@ mod private pub feature : Option< TestOptionsProgressBarFeature >, } - // qqq : remove after Former fix + // qqq : for Petro : remove after Former fix /// Structure for progress bar feature field pub struct TestOptionsProgressBarFeature { diff --git a/module/move/willbe/src/tool/_path.rs b/module/move/willbe/src/tool/_path.rs index cd094111f8..a8209366f7 100644 --- a/module/move/willbe/src/tool/_path.rs +++ b/module/move/willbe/src/tool/_path.rs @@ -101,7 +101,7 @@ pub( crate ) mod private /// Check if path has a glob. #[ allow( dead_code ) ] - pub fn glob_is( path : &str ) -> bool + fn glob_is( path : &str ) -> bool { let glob_chars = "*?[{"; let mut last_char = ' '; @@ -159,7 +159,8 @@ pub( crate ) mod private crate::mod_interface! { - protected use glob_is; + // qqq : remove this? + // protected use glob_is; protected use canonicalize; protected use unique_folder_name; diff --git a/module/move/willbe/tests/inc/action/mod.rs b/module/move/willbe/tests/inc/action/mod.rs index f5f1b151f5..ae10e6d259 100644 --- a/module/move/willbe/tests/inc/action/mod.rs +++ b/module/move/willbe/tests/inc/action/mod.rs @@ -8,5 +8,5 @@ pub mod test; pub mod cicd_renew; pub mod workspace_renew; -// qqq : for Petro : sort +// aaa : for Petro : sort // aaa : sorted & renamed \ No newline at end of file