Skip to content

Commit

Permalink
Merge pull request #1358 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 31, 2024
2 parents 9a7ac6a + f2f2c13 commit 1d60153
Show file tree
Hide file tree
Showing 55 changed files with 627 additions and 270 deletions.
15 changes: 10 additions & 5 deletions module/core/derive_tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ default = [

"derive_from",
"derive_inner_from",
"derive_new",

# "use_std",
]
Expand Down Expand Up @@ -111,16 +112,17 @@ full = [

"derive_from",
"derive_inner_from",
"derive_new",

# "use_std",
]
no_std = []
use_alloc = [ "no_std", "clone_dyn/use_alloc" ]
enabled = []
enabled = [ "derive_tools_meta/enabled" ]

# nightly = [ "derive_more/nightly" ]

type_variadic_from = [ "variadic_from/type_variadic_from" ]
type_variadic_from = [ "variadic_from/enabled", "variadic_from/type_variadic_from" ]
derive_variadic_from = [ "type_variadic_from", "derive_tools_meta/derive_variadic_from", "variadic_from/derive_variadic_from" ]

# enable_track_caller = [ "derive_more", "derive_more/track-caller" ]
Expand Down Expand Up @@ -163,13 +165,15 @@ derive_strum = [ "strum/std", "strum/derive", "strum/strum_macros" ]
strum_phf = [ "strum/std", "strum/phf", "strum/strum_macros" ]
# zzz : review features

derive_clone_dyn = [ "clone_dyn", "clone_dyn/enabled" ]
derive_clone_dyn = [ "clone_dyn/enabled" ]
# derive_clone_dyn_use_std = [ "derive_clone_dyn", "clone_dyn/use_std" ]
# derive_clone_dyn_no_std = [ "derive_clone_dyn", "clone_dyn/no_std" ]
# derive_clone_dyn_use_alloc = [ "derive_clone_dyn", "clone_dyn/use_alloc" ]

derive_from = [ "derive_tools_meta/derive_from" ]
derive_inner_from = [ "derive_tools_meta/derive_inner_from" ]
derive_new = [ "derive_tools_meta/derive_new" ]

parse_display = [ "parse-display" ]

[dependencies]
Expand All @@ -180,10 +184,11 @@ strum = { version = "~0.25", optional = true, default-features = false }
# strum_macros = { version = "~0.25.3", optional = true, default-features = false }
parse-display = { version = "~0.8.2", optional = true, default-features = false }


## internal
derive_tools_meta = { workspace = true, features = [ "enabled" ] }
derive_tools_meta = { workspace = true, features = [] }
variadic_from = { workspace = true, features = [] }
clone_dyn = { workspace = true, optional = true }
clone_dyn = { workspace = true, features = [] }

[dev-dependencies]
test_tools = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ impl From< bool > for IsTransparent
}
}

include!( "./only_test/from_inner.rs" );
include!( "./only_test/basic.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ impl From< ( i32, bool ) > for StructWithManyFields
}
}

include!( "./only_test/from_inner_multiple.rs" );
include!( "./only_test/multiple.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ impl From< ( i32, bool ) > for StructNamedFields
}
}

include!( "./only_test/from_inner_multiple_named.rs" );
include!( "./only_test/multiple_named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ struct StructNamedFields
b: bool,
}

include!( "./only_test/from_inner_multiple_named.rs" );
include!( "./only_test/multiple_named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ use super::*;
#[ derive( Debug, PartialEq, Eq, the_module::From ) ]
struct StructWithManyFields( i32, bool );

include!( "./only_test/from_inner_multiple.rs" );
include!( "./only_test/multiple.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ impl From< i32 > for MyStruct
}
}

include!( "./only_test/from_inner_named.rs" );
include!( "./only_test/named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ struct MyStruct
a : i32,
}

include!( "./only_test/from_inner_named.rs" );
include!( "./only_test/named.rs" );
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#[ test ]
fn from_inner_test()
fn from_test()
{

// let got = IsTransparent::default();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : StructWithManyFields = StructWithManyFields::from((10, true));
let exp = StructWithManyFields( 10 , true );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : StructNamedFields = StructNamedFields::from((10, true));
let exp = StructNamedFields{ a : 10 , b : true };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : MyStruct = MyStruct::from( 13 );
let exp = MyStruct { a : 13 };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : UnitStruct = UnitStruct::from( () );
let exp = UnitStruct;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ use super::*;
pub struct IsTransparent( bool );

// include!( "./manual/basic.rs" );
include!( "./only_test/from_inner.rs" );
include!( "./only_test/basic.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ impl From< () > for UnitStruct
}
}

include!( "./only_test/from_inner_unit.rs" );
include!( "./only_test/unit.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ use super::*;
#[ derive( Debug, Clone, Copy, PartialEq, the_module::From ) ]
struct UnitStruct;

include!( "./only_test/from_inner_unit.rs" );
include!( "./only_test/unit.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ pub enum GetData
// == begin of generated
// == end of generated

include!( "./only_test/from_inner_variants.rs" );
include!( "./only_test/variants.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub enum GetData
// == begin of generated
// == end of generated

include!( "./only_test/from_inner_variants.rs" );
include!( "./only_test/variants.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ impl From< ( String, String ) > for GetData

// == end of generated

include!( "./only_test/from_inner_variants_duplicates.rs" );
include!( "./only_test/variants_duplicates.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ pub enum GetData

// == end of generated

include!( "./only_test/from_inner_variants_duplicates.rs" );
include!( "./only_test/variants_duplicates.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ pub enum GetData
// == begin of generated
// == end of generated

include!( "./only_test/from_inner_variants_duplicates.rs" );
include!( "./only_test/variants_duplicates.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pub enum GetData< 'a, T : ToString + ?Sized = str >
// == begin of generated
// == end of generated

include!( "./only_test/from_inner_variants_generics.rs" );
include!( "./only_test/variants_generics.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ where
// == begin of generated
// == end of generated

include!( "./only_test/from_inner_variants_generics.rs" );
include!( "./only_test/variants_generics.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ impl From< &'static [ u8 ] > for GetData
}
}

include!( "./only_test/from_inner_variants.rs" );
include!( "./only_test/variants.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ impl From< IsTransparent > for bool
}
}

include!( "./only_test/inner_from.rs" );
include!( "./only_test/basic.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ impl From< StructWithManyFields > for ( i32, bool )
}
}

include!( "./only_test/inner_from_multiple.rs" );
include!( "./only_test/multiple.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ impl From< StructNamedFields > for ( i32, bool )
}
}

include!( "./only_test/inner_from_multiple_named.rs" );
include!( "./only_test/multiple_named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ struct StructNamedFields
b: bool,
}

include!( "./only_test/inner_from_multiple_named.rs" );
include!( "./only_test/multiple_named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ use super::*;
#[ derive( Debug, PartialEq, Eq, the_module::InnerFrom ) ]
struct StructWithManyFields( i32, bool );

include!( "./only_test/inner_from_multiple.rs" );
include!( "./only_test/multiple.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ impl From< MyStruct > for i32
}
}

include!( "./only_test/inner_from_named.rs" );
include!( "./only_test/named.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ struct MyStruct
a: i32,
}

include!( "./only_test/inner_from_named.rs" );
include!( "./only_test/named.rs" );
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : ( i32, bool ) = StructWithManyFields( 10, true ).into();
let exp = ( 10 , true );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[ test ]
fn from_inner_named()
fn from_named()
{
let got : ( i32, bool ) = StructNamedFields{ a: 10, b: true }.into();
let exp = ( 10 , true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ use super::*;
#[ derive( Debug, Clone, Copy, PartialEq, the_module::InnerFrom ) ]
pub struct IsTransparent( bool );

// include!( "./manual/basic.rs" );
include!( "./only_test/inner_from.rs" );
include!( "./only_test/basic.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ impl From< UnitStruct > for ()
}

// include!( "./manual/basic.rs" );
include!( "./only_test/inner_from_unit.rs" );
include!( "./only_test/unit.rs" );
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ use super::*;
pub struct UnitStruct;


include!( "./only_test/inner_from_unit.rs" );
include!( "./only_test/unit.rs" );
95 changes: 47 additions & 48 deletions module/core/derive_tools/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,53 +48,52 @@ mod deref_mut_manual_test;
mod deref_mut_test;

#[ cfg( feature = "derive_from" ) ]
mod from_inner_named_test;
mod from_inner_named_manual_test;
#[ path = "from" ]
mod tests
{
#[ allow( unused_imports ) ]
use super::*;

mod named_test;
mod named_manual_test;

mod manual_test;
mod multiple_named_manual_test;
mod multiple_manual_test;
mod unit_manual_test;
mod test;
mod multiple_named_test;
mod unit_test;
mod multiple_test;

mod variants_manual;
mod variants_derive;

mod variants_duplicates_all_off;
mod variants_duplicates_some_off;
mod variants_duplicates_some_off_default_off;

mod variants_generics;
mod variants_generics_where;
mod variants_collisions;
}

mod from_inner_manual_test;
mod from_inner_multiple_named_manual_test;
mod from_inner_multiple_manual_test;
mod from_inner_unit_manual_test;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_test;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_multiple_named_test;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_unit_test;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_multiple_test;

#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_manual;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_derive;

#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_duplicates_all_off;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_duplicates_some_off;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_duplicates_some_off_default_off;

#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_generics;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_generics_where;
#[ cfg( feature = "derive_from" ) ]
mod from_inner_variants_collisions;

mod inner_from_manual_test;
mod inner_from_named_manual_test;
mod inner_from_multiple_named_manual_test;
mod inner_from_multiple_manual_test;
mod inner_from_unit_manual_test;
#[ cfg( feature = "derive_inner_from" ) ]
mod inner_from_test;
#[ cfg( feature = "derive_inner_from" ) ]
mod inner_from_named_test;
#[ cfg( feature = "derive_inner_from" ) ]
mod inner_from_multiple_named_test;
#[ cfg( feature = "derive_inner_from" ) ]
mod inner_from_unit_test;
#[ cfg( feature = "derive_inner_from" ) ]
mod inner_from_multiple_test;
#[ path = "inner_from" ]
mod inner_from_tests
{
#[ allow( unused_imports ) ]
use super::*;

mod manual_test;
mod named_manual_test;
mod multiple_named_manual_test;
mod multiple_manual_test;
mod unit_manual_test;
mod test;
mod named_test;
mod multiple_named_test;
mod unit_test;
mod multiple_test;

}
Loading

0 comments on commit 1d60153

Please sign in to comment.