Skip to content

Commit

Permalink
Merge branch 'alpha' into format_tools_experiment_1
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Aug 13, 2024
2 parents 4d07fcf + 4ab6b06 commit ac14ca0
Show file tree
Hide file tree
Showing 125 changed files with 1,681 additions and 82 deletions.
4 changes: 2 additions & 2 deletions module/core/clone_dyn/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ The main function demonstrates the overall usage by creating a vector, obtaining


```rust
# #[ cfg( not( feature = "enabled" ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "clone_dyn_meta" ) ) ) ]
# fn main() {}
# #[ cfg( feature = "enabled" ) ]
# #[ cfg( all( feature = "enabled", feature = "clone_dyn_meta" ) ) ]
# fn main()
# {

Expand Down
4 changes: 2 additions & 2 deletions module/core/clone_dyn/examples/clone_dyn_trivial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
//! The main function demonstrates the overall usage by creating a vector, obtaining an iterator, and using the iterator to print elements.
//!
#[ cfg( not( feature = "enabled" ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "clone_dyn_meta" ) ) ) ]
fn main() {}
#[ cfg( feature = "enabled" ) ]
#[ cfg( all( feature = "enabled", feature = "clone_dyn_meta" ) ) ]
fn main()
{
use clone_dyn::{ clone_dyn, CloneDyn };
Expand Down
9 changes: 6 additions & 3 deletions module/core/clone_dyn/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#[ allow( unused_imports ) ]
use super::*;

mod basic_manual;
mod basic;
mod parametrized;
#[ cfg( feature = "clone_dyn_meta" ) ]
pub mod basic_manual;
#[ cfg( feature = "clone_dyn_meta" ) ]
pub mod basic;
#[ cfg( feature = "clone_dyn_meta" ) ]
pub mod parametrized;
3 changes: 2 additions & 1 deletion module/core/derive_tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ derive_into_iterator = [ "derive_more", "derive_more/std", "derive_more/into_ite
derive_into = [ "derive_more", "derive_more/into" ]
derive_mul_assign = [ "derive_more", "derive_more/std", "derive_more/mul_assign" ]
derive_mul = [ "derive_more", "derive_more/std", "derive_more/mul" ]
derive_not = [ "derive_more", "derive_more/std", "derive_more/not" ]
derive_sum = [ "derive_more", "derive_more/std", "derive_more/sum" ]
derive_try_into = [ "derive_more", "derive_more/std", "derive_more/try_into" ]
derive_is_variant = [ "derive_more", "derive_more/is_variant" ]
Expand All @@ -185,6 +184,8 @@ derive_index_mut = [ "derive_tools_meta/derive_index_mut" ]
derive_inner_from = [ "derive_tools_meta/derive_inner_from" ]
derive_new = [ "derive_tools_meta/derive_new" ]

derive_not = [ "derive_tools_meta/derive_not" ]

derive_phantom = [ "derive_tools_meta/derive_phantom" ]

parse_display = [ "parse-display" ]
Expand Down
2 changes: 2 additions & 0 deletions module/core/derive_tools/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fn main()
feature = "derive_index_mut",
feature = "derive_inner_from",
feature = "derive_variadic_from",
feature = "derive_not",
feature = "derive_reflect",
feature = "derive_phantom"
)
Expand All @@ -42,6 +43,7 @@ fn main()
feature = "derive_index_mut",
feature = "derive_inner_from",
feature = "derive_variadic_from",
feature = "derive_not",
feature = "derive_reflect",
feature = "derive_phantom"
)
Expand Down
2 changes: 0 additions & 2 deletions module/core/derive_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ mod derive_more
pub use ::derive_more::{ Mul, Div };
#[ cfg( feature = "derive_mul_assign" ) ]
pub use ::derive_more::{ MulAssign, DivAssign };
#[ cfg( feature = "derive_not" ) ]
pub use ::derive_more::Not;
#[ cfg( feature = "derive_sum" ) ]
pub use ::derive_more::Sum;
#[ cfg( feature = "derive_try_into" ) ]
Expand Down
56 changes: 56 additions & 0 deletions module/core/derive_tools/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mod all_manual_test;
feature = "derive_index",
feature = "derive_index_mut",
feature = "derive_inner_from",
feature = "derive_not",
feature = "derive_phantom"
)
)]
Expand Down Expand Up @@ -225,6 +226,61 @@ mod from_tests
mod variants_collisions;
}

#[ cfg( feature = "derive_not" ) ]
#[ path = "not" ]
mod not_tests
{
#[ allow( unused_imports ) ]
use super::*;

mod struct_named;
mod struct_named_manual;
mod struct_named_empty;
mod struct_named_empty_manual;
mod struct_tuple;
mod struct_tuple_manual;
mod struct_tuple_empty;
mod struct_tuple_empty_manual;
mod struct_unit;
mod struct_unit_manual;
mod named_reference_field;
mod named_reference_field_manual;
mod named_mut_reference_field;
mod named_mut_reference_field_manual;
mod tuple_reference_field;
mod tuple_reference_field_manual;
mod tuple_mut_reference_field;
mod tuple_mut_reference_field_manual;
mod bounds_inlined;
mod bounds_inlined_manual;
mod bounds_mixed;
mod bounds_mixed_manual;
mod bounds_where;
mod bounds_where_manual;
mod with_custom_type;
mod name_collisions;
mod named_default_off;
mod named_default_off_manual;
mod named_default_off_reference_on;
mod named_default_off_reference_on_manual;
mod named_default_off_some_on;
mod named_default_off_some_on_manual;
mod named_default_on_mut_reference_off;
mod named_default_on_mut_reference_off_manual;
mod named_default_on_some_off;
mod named_default_on_some_off_manual;
mod tuple_default_off;
mod tuple_default_off_manual;
mod tuple_default_off_reference_on;
mod tuple_default_off_reference_on_manual;
mod tuple_default_off_some_on;
mod tuple_default_off_some_on_manual;
mod tuple_default_on_mut_reference_off;
mod tuple_default_on_mut_reference_off_manual;
mod tuple_default_on_some_off;
mod tuple_default_on_some_off_manual;
}

#[ cfg( feature = "derive_inner_from" ) ]
#[ path = "inner_from" ]
mod inner_from_tests
Expand Down
13 changes: 13 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_inlined.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::fmt::Debug;
use core::ops::Not;
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
struct BoundsInlined< T : ToString + Not< Output = T >, U : Debug + Not< Output = U > >
{
a : T,
b : U,
}

include!( "./only_test/bounds_inlined.rs" );
21 changes: 21 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_inlined_manual.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use std::fmt::Debug;
use core::ops::Not;

#[ allow( dead_code ) ]
struct BoundsInlined< T : ToString + Not< Output = T >, U : Debug + Not< Output = U > >
{
a: T,
b: U,
}

impl< T : ToString + Not< Output = T >, U : Debug + Not< Output = U > > Not for BoundsInlined< T, U >
{
type Output = Self;

fn not( self ) -> Self::Output
{
Self { a : !self.a, b : !self.b }
}
}

include!( "./only_test/bounds_inlined.rs" );
15 changes: 15 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_mixed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::fmt::Debug;
use core::ops::Not;
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
struct BoundsMixed< T : ToString + Not< Output = T >, U >
where
U : Debug + Not< Output = U >,
{
a: T,
b: U,
}

include!( "./only_test/bounds_mixed.rs" );
25 changes: 25 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_mixed_manual.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::fmt::Debug;
use core::ops::Not;

#[ allow( dead_code ) ]
struct BoundsMixed< T : ToString + Not< Output = T >, U >
where
U : Debug + Not< Output = U >,
{
a : T,
b : U,
}

impl< T : ToString + Not< Output = T >, U > Not for BoundsMixed< T, U >
where
U : Debug + Not< Output = U >,
{
type Output = Self;

fn not( self ) -> Self::Output
{
Self { a : !self.a, b : !self.b }
}
}

include!( "./only_test/bounds_mixed.rs" );
16 changes: 16 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_where.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::fmt::Debug;
use core::ops::Not;
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
struct BoundsWhere< T, U >
where
T : ToString + Not< Output = T >,
U : Debug + Not< Output = U >,
{
a : T,
b : U,
}

include!( "./only_test/bounds_where.rs" );
27 changes: 27 additions & 0 deletions module/core/derive_tools/tests/inc/not/bounds_where_manual.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::fmt::Debug;
use core::ops::Not;

#[ allow( dead_code ) ]
struct BoundsWhere< T, U >
where
T: ToString + Not< Output = T >,
U: Debug + Not< Output = U >,
{
a : T,
b : U,
}

impl< T, U > Not for BoundsWhere< T, U >
where
T : ToString + Not< Output = T >,
U : Debug + Not< Output = U >,
{
type Output = Self;

fn not( self ) -> Self::Output
{
Self { a : !self.a, b : !self.b }
}
}

include!( "./only_test/bounds_where.rs" );
14 changes: 14 additions & 0 deletions module/core/derive_tools/tests/inc/not/name_collisions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use super::*;

pub mod core {}
pub mod std {}

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
struct NameCollisions
{
a : bool,
b : u8,
}

include!( "./only_test/name_collisions.rs" );
12 changes: 12 additions & 0 deletions module/core/derive_tools/tests/inc/not/named_default_off.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
#[ not( off ) ]
struct NamedDefaultOff
{
a : bool,
b : u8,
}

include!( "only_test/named_default_off.rs" );
20 changes: 20 additions & 0 deletions module/core/derive_tools/tests/inc/not/named_default_off_manual.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use core::ops::Not;

#[ allow( dead_code ) ]
struct NamedDefaultOff
{
a : bool,
b : u8,
}

impl Not for NamedDefaultOff
{
type Output = Self;

fn not( self ) -> Self::Output
{
Self { a : self.a, b : self.b }
}
}

include!( "only_test/named_default_off.rs" );
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
#[ not( off ) ]
struct NamedDefaultOffReferenceOn< 'a >
{
#[ not( on ) ]
a : &'a bool,
b : u8,
}

include!( "only_test/named_default_off_reference_on.rs" );
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use core::ops::Not;

#[ allow( dead_code ) ]
struct NamedDefaultOffReferenceOn< 'a >
{
a : &'a bool,
b : u8,
}

impl< 'a > Not for NamedDefaultOffReferenceOn< 'a >
{
type Output = Self;

fn not(self) -> Self::Output
{
Self { a: self.a, b : self.b }
}
}

include!( "only_test/named_default_off_reference_on.rs" );
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use super::*;

#[ allow( dead_code ) ]
#[ derive( the_module::Not ) ]
#[ not( off )]
struct NamedDefaultOffSomeOn
{
a : bool,
#[ not( on ) ]
b : u8,
}

include!( "only_test/named_default_off_some_on.rs" );
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use core::ops::Not;

#[ allow( dead_code ) ]
struct NamedDefaultOffSomeOn
{
a : bool,
b : u8,
}

impl Not for NamedDefaultOffSomeOn
{
type Output = Self;

fn not( self ) -> Self::Output
{
Self { a: self.a, b: !self.b }
}
}

include!( "only_test/named_default_off_some_on.rs" );
Loading

0 comments on commit ac14ca0

Please sign in to comment.