Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 2, 2024
1 parent 9eaa170 commit 46e46b3
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ pub struct Struct1
#[ subformer( the_module::VectorSubformer ) ]
vec_1 : Vec< String >,
#[ subformer( the_module::HashMapSubformer ) ]
hashmap_strings_1 : std::collections::HashMap< String, String >,
hashmap_1 : std::collections::HashMap< String, String >,
#[ subformer( the_module::HashSetSubformer ) ]
hashset_strings_1 : std::collections::HashSet< String >,
hashset_1 : std::collections::HashSet< String >,
}

// include!( "./only_test/containers_with_subformer.rs" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use super::*;
pub struct Struct1
{
vec_1 : Vec< String >,
hashmap_strings_1 : std::collections::HashMap< String, String >,
hashset_strings_1 : std::collections::HashSet< String >,
hashmap_1 : std::collections::HashMap< String, String >,
hashset_1 : std::collections::HashSet< String >,
}

// = formed
Expand All @@ -27,8 +27,8 @@ impl Struct1
pub struct Struct1FormerStorage
{
pub vec_1 : ::core::option::Option< Vec< String > >,
pub hashmap_strings_1 : ::core::option::Option< std::collections::HashMap< String, String > >,
pub hashset_strings_1 : ::core::option::Option< std::collections::HashSet< String > >,
pub hashmap_1 : ::core::option::Option< std::collections::HashMap< String, String > >,
pub hashset_1 : ::core::option::Option< std::collections::HashSet< String > >,
}

impl Default for Struct1FormerStorage
Expand All @@ -40,8 +40,8 @@ impl Default for Struct1FormerStorage
Self
{
vec_1 : None,
hashmap_strings_1 : None,
hashset_strings_1 : None,
hashmap_1 : None,
hashset_1 : None,
}
}

Expand Down Expand Up @@ -81,19 +81,19 @@ where
val
};

let hashmap_strings_1 = if self.storage.hashmap_strings_1.is_some()
let hashmap_1 = if self.storage.hashmap_1.is_some()
{
self.storage.hashmap_strings_1.take().unwrap()
self.storage.hashmap_1.take().unwrap()
}
else
{
let val : std::collections::HashMap< String, String > = Default::default();
val
};

let hashset_strings_1 = if self.storage.hashset_strings_1.is_some()
let hashset_1 = if self.storage.hashset_1.is_some()
{
self.storage.hashset_strings_1.take().unwrap()
self.storage.hashset_1.take().unwrap()
}
else
{
Expand All @@ -104,8 +104,8 @@ where
Struct1
{
vec_1,
hashmap_strings_1,
hashset_strings_1,
hashmap_1,
hashset_1,
}

}
Expand Down Expand Up @@ -212,7 +212,7 @@ where
// the_module::VectorSubformer::< String, Vec< String >, Self, _ >::begin( Some( self ), formed, on_end )
// }

pub fn hashmap_strings_1( mut self ) -> the_module::HashMapSubformer
pub fn hashmap_1( mut self ) -> the_module::HashMapSubformer
<
String,
String,
Expand All @@ -221,29 +221,29 @@ where
impl the_module::FormingEnd< std::collections::HashMap< String, String >, Self >,
>
{
let formed = self.storage.hashmap_strings_1.take();
let formed = self.storage.hashmap_1.take();
let on_end = | formed : std::collections::HashMap< String, String >, super_former : ::core::option::Option< Self > | -> Self
{
let mut super_former = super_former.unwrap();
super_former.storage.hashmap_strings_1 = Some( formed );
super_former.storage.hashmap_1 = Some( formed );
super_former
};
the_module::HashMapSubformer::begin( formed, Some( self ), on_end )
}

pub fn hashset_strings_1( mut self ) -> the_module::HashSetSubformer
pub fn hashset_1( mut self ) -> the_module::HashSetSubformer
<
String,
std::collections::HashSet< String >,
Self,
impl the_module::FormingEnd< std::collections::HashSet< String >, Self >,
>
{
let formed = self.storage.hashset_strings_1.take();
let formed = self.storage.hashset_1.take();
let on_end = | formed : std::collections::HashSet< String >, super_former : ::core::option::Option< Self > | -> Self
{
let mut super_former = super_former.unwrap();
super_former.storage.hashset_strings_1 = Some( formed );
super_former.storage.hashset_1 = Some( formed );
super_former
};
the_module::HashSetSubformer::begin( formed, Some( self ), on_end )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use super::*;
pub struct Struct1
{
vec_1 : Vec< String >,
hashmap_strings_1 : std::collections::HashMap< String, String >,
hashset_strings_1 : std::collections::HashSet< String >,
hashmap_1 : std::collections::HashMap< String, String >,
hashset_1 : std::collections::HashSet< String >,
}

// = generated
Expand Down Expand Up @@ -83,10 +83,10 @@ pub struct Struct1FormerStorage
pub vec_1 : ::core::option::Option< Vec< String > >,

#[ doc = r" A field" ]
pub hashmap_strings_1 : ::core::option::Option< std::collections::HashMap< String, String > >,
pub hashmap_1 : ::core::option::Option< std::collections::HashMap< String, String > >,

#[ doc = r" A field" ]
pub hashset_strings_1 : ::core::option::Option< std::collections::HashSet< String > >,
pub hashset_1 : ::core::option::Option< std::collections::HashSet< String > >,
}

impl ::core::default::Default for Struct1FormerStorage
Expand All @@ -97,8 +97,8 @@ impl ::core::default::Default for Struct1FormerStorage
Self
{
vec_1 : ::core::option::Option::None,
hashmap_strings_1 : ::core::option::Option::None,
hashset_strings_1 : ::core::option::Option::None,
hashmap_1 : ::core::option::Option::None,
hashset_1 : ::core::option::Option::None,
}
}
}
Expand Down Expand Up @@ -138,9 +138,9 @@ impl former::StoragePreform for Struct1FormerStorage
( &::core::marker::PhantomData::< Vec< String > > ).maybe_default()
}
};
let hashmap_strings_1 = if self.hashmap_strings_1.is_some()
let hashmap_1 = if self.hashmap_1.is_some()
{
self.hashmap_strings_1.take().unwrap()
self.hashmap_1.take().unwrap()
}
else
{
Expand All @@ -149,7 +149,7 @@ impl former::StoragePreform for Struct1FormerStorage
{
fn maybe_default( self : &Self ) -> T
{
panic!( "Field 'hashmap_strings_1' isn't initialized" )
panic!( "Field 'hashmap_1' isn't initialized" )
}
}
impl< T > MaybeDefault< T > for &::core::marker::PhantomData< T > {}
Expand All @@ -164,9 +164,9 @@ impl former::StoragePreform for Struct1FormerStorage
( &::core::marker::PhantomData::< std::collections::HashMap< String, String > > ).maybe_default()
}
};
let hashset_strings_1 = if self.hashset_strings_1.is_some()
let hashset_1 = if self.hashset_1.is_some()
{
self.hashset_strings_1.take().unwrap()
self.hashset_1.take().unwrap()
}
else
{
Expand All @@ -175,7 +175,7 @@ impl former::StoragePreform for Struct1FormerStorage
{
fn maybe_default( self : &Self ) -> T
{
panic!( "Field 'hashset_strings_1' isn't initialized" )
panic!( "Field 'hashset_1' isn't initialized" )
}
}
impl< T > MaybeDefault< T > for &::core::marker::PhantomData< T > {}
Expand All @@ -193,8 +193,8 @@ impl former::StoragePreform for Struct1FormerStorage
let result = Struct1
{
vec_1,
hashmap_strings_1,
hashset_strings_1,
hashmap_1,
hashset_1,
};
return result;
}
Expand Down Expand Up @@ -385,7 +385,7 @@ where
// }

#[ inline( always ) ]
pub fn hashmap_strings_1_set< Former2 >( self ) -> Former2
pub fn hashmap_1_set< Former2 >( self ) -> Former2
where
Former2 : former::FormerBegin
<
Expand All @@ -395,27 +395,27 @@ where
String,
Self,
Self,
__hashmap_strings_1_end,
__hashmap_1_end,
>
>,
{
Former2::_begin( None, Some( self ), __hashmap_strings_1_end )
Former2::_begin( None, Some( self ), __hashmap_1_end )
}

pub fn hashmap_strings_1( self ) ->
pub fn hashmap_1( self ) ->
former::ContainerSubformer::
<
( String, String ), former::HashMapDefinition< String, String, Self, Self, __hashmap_strings_1_end >
( String, String ), former::HashMapDefinition< String, String, Self, Self, __hashmap_1_end >
>
{
self.hashmap_strings_1_set::< former::ContainerSubformer::
self.hashmap_1_set::< former::ContainerSubformer::
<
( String, String ), former::HashMapDefinition< String, String, Self, Self, __hashmap_strings_1_end >
( String, String ), former::HashMapDefinition< String, String, Self, Self, __hashmap_1_end >
>>()
}

#[ inline( always ) ]
pub fn hashset_strings_1_set< Former2 >( self ) -> Former2
pub fn hashset_1_set< Former2 >( self ) -> Former2
where
Former2 : former::FormerBegin
<
Expand All @@ -424,22 +424,22 @@ where
String,
Self,
Self,
__hashset_strings_1_end,
__hashset_1_end,
>
>,
{
Former2::_begin( None, Some( self ), __hashset_strings_1_end )
Former2::_begin( None, Some( self ), __hashset_1_end )
}

pub fn hashset_strings_1( self ) ->
pub fn hashset_1( self ) ->
former::ContainerSubformer::
<
String, former::HashSetDefinition< String, Self, Self, __hashset_strings_1_end >
String, former::HashSetDefinition< String, Self, Self, __hashset_1_end >
>
{
self.hashset_strings_1_set::< former::ContainerSubformer::
self.hashset_1_set::< former::ContainerSubformer::
<
String, former::HashSetDefinition< String, Self, Self, __hashset_strings_1_end >
String, former::HashSetDefinition< String, Self, Self, __hashset_1_end >
>>()
}

Expand Down Expand Up @@ -493,13 +493,13 @@ where
// zzz : description
/// Return original former after subformer for `hashmap_string_1` is done.
#[ allow( non_camel_case_types ) ]
pub struct __hashmap_strings_1_end;
pub struct __hashmap_1_end;
#[ automatically_derived ]
impl< Definition > former::FormingEnd
<
former::HashMapDefinition< String, String, Struct1Former< Definition >, Struct1Former< Definition >, former::NoEnd >,
>
for __hashmap_strings_1_end
for __hashmap_1_end
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes
Expand All @@ -511,13 +511,13 @@ where
fn call( &self, storage : std::collections::HashMap< String, String >, super_former : Option< Struct1Former< Definition > > ) -> Struct1Former< Definition >
{
let mut super_former = super_former.unwrap();
if let Some( ref mut field ) = super_former.storage.hashmap_strings_1
if let Some( ref mut field ) = super_former.storage.hashmap_1
{
former::ContainerAssign::assign( field, storage );
}
else
{
super_former.storage.hashmap_strings_1 = Some( storage );
super_former.storage.hashmap_1 = Some( storage );
}
super_former
}
Expand All @@ -526,13 +526,13 @@ where
// zzz : description
/// Return original former after subformer for `hashset_string_1` is done.
#[ allow( non_camel_case_types ) ]
pub struct __hashset_strings_1_end;
pub struct __hashset_1_end;
#[ automatically_derived ]
impl< Definition > former::FormingEnd
<
former::HashSetDefinition< String, Struct1Former< Definition >, Struct1Former< Definition >, former::NoEnd >,
>
for __hashset_strings_1_end
for __hashset_1_end
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes
Expand All @@ -544,13 +544,13 @@ where
fn call( &self, storage : std::collections::HashSet< String >, super_former : Option< Struct1Former< Definition > > ) -> Struct1Former< Definition >
{
let mut super_former = super_former.unwrap();
if let Some( ref mut field ) = super_former.storage.hashset_strings_1
if let Some( ref mut field ) = super_former.storage.hashset_1
{
former::ContainerAssign::assign( field, storage );
}
else
{
super_former.storage.hashset_strings_1 = Some( storage );
super_former.storage.hashset_1 = Some( storage );
}
super_former
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::collections::HashSet;
pub struct Struct1
{
vec_1 : Vec< String >,
hashmap_strings_1 : HashMap< String, String >,
hashset_strings_1 : HashSet< String >,
hashmap_1 : HashMap< String, String >,
hashset_1 : HashSet< String >,
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct Struct1
string_optional_1 : Option< String >,

vec_1 : Vec< String >,
hashmap_strings_1 : HashMap< String, String >,
hashset_strings_1 : HashSet< String >,
hashmap_1 : HashMap< String, String >,
hashset_1 : HashSet< String >,
}

//
Expand All @@ -55,8 +55,8 @@ tests_impls!
int_optional_1 : Some( 31 ),
string_optional_1 : Some( "abc".to_string() ),
vec_1 : vec![],
hashmap_strings_1 : hmap!{},
hashset_strings_1 : hset!{},
hashmap_1 : hmap!{},
hashset_1 : hset!{},
};
a_id!( command, expected );
}
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/tests/inc/former_tests/name_collisions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type HashMap = ();
pub struct Struct1
{
vec_1 : Vec< String >,
hashmap_strings_1 : std::collections::HashMap< String, String >,
hashset_strings_1 : std::collections::HashSet< String >,
hashmap_1 : std::collections::HashMap< String, String >,
hashset_1 : std::collections::HashSet< String >,
}

//
Expand Down
Loading

0 comments on commit 46e46b3

Please sign in to comment.