Skip to content

Commit

Permalink
Merge pull request #1352 from Wandalen/program_tools_v1
Browse files Browse the repository at this point in the history
AUTO : Forward from program_tools_v1 to alpha
  • Loading branch information
Wandalen authored May 26, 2024
2 parents a853d1f + fee118d commit 52f7257
Show file tree
Hide file tree
Showing 78 changed files with 2,945 additions and 1,045 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ default-features = false
features = [ "enabled" ]

[workspace.dependencies.collection_tools]
version = "~0.6.0"
version = "~0.8.0"
path = "module/core/collection_tools"
default-features = false

Expand Down Expand Up @@ -214,6 +214,11 @@ version = "~2.0.0"
path = "module/core/former_meta"
default-features = false

[workspace.dependencies.former_types]
version = "~2.1.0"
path = "module/core/former_types"
default-features = false

[workspace.dependencies.impls_index]
version = "~0.7.0"
path = "module/core/impls_index"
Expand Down
8 changes: 4 additions & 4 deletions module/core/collection_tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "collection_tools"
version = "0.6.0"
version = "0.8.0"
edition = "2021"
authors = [
"Kostiantyn Wandalen <[email protected]>",
Expand Down Expand Up @@ -39,20 +39,20 @@ use_alloc = [

default = [
"enabled",
"reexports",
# "reexports",
"collection_constructors",
"collection_into_constructors",
]

full = [
"enabled",
"reexports",
# "reexports",
"collection_constructors",
"collection_into_constructors",
]

enabled = []
reexports = []
# reexports = []

# Collection constructors, like `hmap!{ "key" => "val" }`
collection_constructors = []
Expand Down
27 changes: 13 additions & 14 deletions module/core/collection_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
extern crate alloc;

// qqq : make subdirectory for each container -- done

// qqq : move out of lib.rs file -- moved to `collections.rs`

/// Module containing all collection macros
#[ cfg( feature = "enabled" ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
Expand Down Expand Up @@ -59,18 +55,12 @@ pub mod orphan
#[ cfg( feature = "enabled" ) ]
pub mod exposed
{

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use super::prelude::*;
}

/// Prelude to use essentials: `use my_module::prelude::*`.
#[ cfg( feature = "enabled" ) ]
pub mod prelude
{

// qqq : for Anton : uncomment, make it working and cover by tests -- renamed to reexports
#[ cfg( feature = "reexports" ) ]
// #[ cfg( feature = "reexports" ) ]
#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
Expand All @@ -86,14 +76,23 @@ pub mod prelude
vecd::VecDeque,
};

#[ cfg( feature = "reexports" ) ]
// #[ cfg( feature = "reexports" ) ]
#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use
pub use
{
HashMap as Map,
HashSet as Set,
Vec as DynArray,
};

// qqq : cover by tests presence of all containers immidiately in collection_tools::* and in collection_tools::exposed::*

}

/// Prelude to use essentials: `use my_module::prelude::*`.
#[ cfg( feature = "enabled" ) ]
pub mod prelude
{
}
3 changes: 2 additions & 1 deletion module/core/data_type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ no_std = []
use_alloc = [ "no_std" ]
enabled = []

dt_prelude = [ "collection_tools/reexports" ]
# dt_prelude = [ "collection_tools/reexports" ]
dt_prelude = [] # rid off maybe?
dt_interval = [ "interval_adapter/enabled" ]
dt_collections = [ "collection_tools/enabled" ]
dt_either = [ "either" ]
Expand Down
6 changes: 3 additions & 3 deletions module/core/derive_tools_meta/src/derive/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl FieldAttributes
for attr in attrs
{
let key_ident = attr.path().get_ident()
.ok_or_else( || syn_err!( attr, "Expects an attribute of format #[ attribute( val ) ], but got:\n {}", qt!{ #attr } ) )?;
.ok_or_else( || syn_err!( attr, "Expects an attribute of format #[ attribute( key1 = val1, key2 = val2 ) ], but got:\n {}", qt!{ #attr } ) )?;
let key_str = format!( "{}", key_ident );

if attr::is_standard( &key_str )
Expand Down Expand Up @@ -518,9 +518,9 @@ impl syn::parse::Parse for AttributeFrom
}

// Optional comma handling
if input.peek( syn::Token![,] )
if input.peek( syn::Token![ , ] )
{
input.parse::< syn::Token![,] >()?;
input.parse::< syn::Token![ , ] >()?;
}
Ok( Self { enabled, hint } )
}
Expand Down
20 changes: 13 additions & 7 deletions module/core/former/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ all-features = false

[features]

no_std = [ "collection_tools/no_std" ]
use_alloc = [ "no_std", "collection_tools/use_alloc" ]
no_std = [ "former_types/no_std", "collection_tools/no_std" ]
use_alloc = [ "no_std", "former_types/use_alloc", "collection_tools/use_alloc" ]


# no_std = [ "collection_tools/no_std" ]
# use_alloc = [ "no_std", "collection_tools/use_alloc" ]

default = [
"enabled",
Expand All @@ -47,20 +51,22 @@ full = [
"derive_components_assign",
"derive_from_components",
]
enabled = [ "former_meta/enabled", "collection_tools/enabled" ]
enabled = [ "former_meta/enabled", "former_types/enabled" ]

derive_former = [ "former_meta/derive_former" ]
derive_components = [ "former_meta/derive_components" ]
derive_component_assign = [ "derive_components", "former_meta/derive_component_assign" ]
derive_former = [ "former_meta/derive_former", "former_types/derive_former" ]
derive_components = [ "former_meta/derive_components", "former_types/types_components" ]
derive_component_assign = [ "derive_components", "former_meta/derive_component_assign", "former_types/types_component_assign" ]
derive_components_assign = [ "derive_components", "derive_component_assign", "former_meta/derive_components_assign" ]
derive_component_from = [ "derive_components", "former_meta/derive_component_from" ]
derive_from_components = [ "derive_components", "former_meta/derive_from_components" ]


[dependencies]
former_meta = { workspace = true }
collection_tools = { workspace = true, features = [ "collection_constructors", "reexports" ] }
former_types = { workspace = true }
# collection_tools = { workspace = true, features = [ "collection_constructors" ] }


[dev-dependencies]
test_tools = { workspace = true, features = [ "full" ] }
collection_tools = { workspace = true, features = [ "collection_constructors" ] }
98 changes: 53 additions & 45 deletions module/core/former/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,39 @@
#![ doc( html_root_url = "https://docs.rs/former/latest/former/" ) ]
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]

/// Axiomatic things.
#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_former" ) ]
mod axiomatic;
/// Forming process.
#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_former" ) ]
mod definition;
/// Forming process.
#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_former" ) ]
mod forming;
/// Storage.
#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_former" ) ]
mod storage;

/// Interface for collections.
#[ cfg( feature = "enabled" ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ cfg( feature = "derive_former" ) ]
mod collection;

/// Component-based forming.
#[ cfg( feature = "enabled" ) ]
#[ cfg( any( feature = "derive_component_from", feature = "derive_component_assign" ) ) ]
mod component;
// /// Axiomatic things.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( feature = "derive_former" ) ]
// mod axiomatic;
// /// Forming process.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( feature = "derive_former" ) ]
// mod definition;
// /// Forming process.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( feature = "derive_former" ) ]
// mod forming;
// /// Storage.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( feature = "derive_former" ) ]
// mod storage;
//
// /// Interface for collections.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
// #[ cfg( feature = "derive_former" ) ]
// mod collection;
//
// /// Component-based forming.
// #[ cfg( feature = "enabled" ) ]
// #[ cfg( any( feature = "derive_component_from", feature = "derive_component_assign" ) ) ]
// mod component;

/// Namespace with dependencies.
#[ cfg( feature = "enabled" ) ]
pub mod dependency
{
pub use former_types;
pub use former_meta;
}

Expand Down Expand Up @@ -80,32 +81,39 @@ pub mod exposed

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ cfg( feature = "enabled" ) ]
#[ cfg( feature = "derive_former" ) ]
pub use super::
{
axiomatic::*,
definition::*,
forming::*,
storage::*,
};
pub use former_types::exposed::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ cfg( feature = "enabled" ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ cfg( feature = "derive_former" ) ]
pub use super::collection::*;
// #[ doc( inline ) ]
// #[ allow( unused_imports ) ]
// #[ cfg( feature = "derive_former" ) ]
// pub use super::
// {
// axiomatic::*,
// definition::*,
// forming::*,
// storage::*,
// };
//
// #[ doc( inline ) ]
// #[ allow( unused_imports ) ]
// #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
// #[ cfg( feature = "derive_former" ) ]
// pub use super::collection::*;

}

/// Prelude to use essentials: `use my_module::prelude::*`.
#[ cfg( feature = "enabled" ) ]
pub mod prelude
{

// #[ doc( inline ) ]
// #[ allow( unused_imports ) ]
// #[ cfg( any( feature = "derive_component_from", feature = "derive_component_assign" ) ) ]
// pub use super::component::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ cfg( feature = "enabled" ) ]
#[ cfg( any( feature = "derive_component_from", feature = "derive_component_assign" ) ) ]
pub use super::component::*;
pub use former_types::prelude::*;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ struct Person

//

include!( "./only_test/components_component_assign.rs" );
include!( "./only_test/component_assign.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ where

//

include!( "./only_test/components_component_assign.rs" );
include!( "./only_test/component_assign.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ pub struct Options1
//


include!( "./only_test/components_component_from.rs" );
include!( "./only_test/component_from.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ impl From< &Options1 > for f32

//

include!( "./only_test/components_component_from.rs" );
include!( "./only_test/component_from.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ impl From< &Options2 > for String

//

include!( "./only_test/components_components_assign.rs" );
include!( "./only_test/components_assign.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ where

//

include!( "./only_test/components_components_assign.rs" );
include!( "./only_test/components_assign.rs" );
2 changes: 1 addition & 1 deletion module/core/former/tests/inc/components_tests/composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ pub struct Options2

//

include!( "./only_test/components_composite.rs" );
include!( "./only_test/composite.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ where

//

include!( "./only_test/components_composite.rs" );
include!( "./only_test/composite.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ pub struct Options2

//

include!( "./only_test/components_from_components.rs" );
include!( "./only_test/from_components.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ where

//

include!( "./only_test/components_from_components.rs" );
include!( "./only_test/from_components.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn component_assign()
let mut o2 = Options2::default();
o2.assign( 42 );
o2.assign( "Hello, world!" );
println!( "field1: {}, field2: {}", o2.field1, o2.field2 );
println!( "field1 : {}, field2 : {}", o2.field1, o2.field2 );
let exp = Options2 { field1 : 42, field2 : "Hello, world!".to_string() };
assert_eq!( o2, exp );

Expand Down
Loading

0 comments on commit 52f7257

Please sign in to comment.