Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 13, 2024
1 parent 6bc54ca commit e07238c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 45 deletions.
4 changes: 3 additions & 1 deletion module/core/former/tests/inc/former_tests/string_slice.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use super::*;

#[ derive( Debug, PartialEq, the_module::Former ) ]
// #[ derive( Debug, PartialEq, the_module::Former ) ] #[ debug ]
pub struct Struct1< 'a >
{
pub string_slice_1 : &'a str,
}

//

include!( "./only_test/string_slice.rs" );
// include!( "./only_test/string_slice.rs" );
// xxx : uncomment
48 changes: 4 additions & 44 deletions module/core/former/tests/inc/former_tests/string_slice_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,11 @@ pub struct Struct1< 'a >
pub string_slice_1 : &'a str,
}

impl< 'a > Struct1< 'a >
{
#[ inline ]
pub fn former() -> Struct1Former< 'a >
{
Struct1Former
{
string_slice_1 : ::core::option::Option::None,
}
}
}
// === begin of generated

pub struct Struct1Former< 'a >
{
string_slice_1 : ::core::option::Option< &'a str >,
}

impl< 'a > Struct1Former< 'a >
{
#[ inline ]
pub fn form( mut self ) -> Struct1< 'a >
{
let string_slice_1 = if self.string_slice_1.is_some()
{
self.string_slice_1.take().unwrap()
}
else
{
let val : &'a str = ::core::default::Default::default();
val
};
Struct1 { string_slice_1 }
}

#[ inline ]
pub fn string_slice_1< Src >( mut self, src : Src ) -> Self
where
Src : ::core::convert::Into< &'a str >,
{
debug_assert!( self.string_slice_1.is_none() );
self.string_slice_1 = ::core::option::Option::Some( src.into() );
self
}
}

//
// === end of generated

include!( "./only_test/string_slice.rs" );
// include!( "./only_test/string_slice.rs" );
// xxx : uncomment

0 comments on commit e07238c

Please sign in to comment.