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 e448f48 commit 78c70ad
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions module/core/former/tests/inc/former_tests/a_basic_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct Struct1
#[ automatically_derived ]
impl Struct1
{

#[ inline( always ) ]
pub fn former() -> Struct1Former< >
{
Expand Down Expand Up @@ -70,6 +71,7 @@ pub struct Struct1FormerStorage

impl ::core::default::Default for Struct1FormerStorage
{

#[ inline( always ) ]
fn default() -> Self
{
Expand Down Expand Up @@ -115,6 +117,7 @@ impl former::StoragePreform for Struct1FormerStorage
return result;
}
}

pub struct Struct1Former< Definition = Struct1FormerDefinition >
where Definition : former::FormerDefinition, Definition::Types : former::FormerDefinitionTypes< Storage = Struct1FormerStorage >,
{
Expand All @@ -127,30 +130,35 @@ where Definition : former::FormerDefinition, Definition::Types : former::FormerD
impl< Definition > Struct1Former< Definition >
where Definition : former::FormerDefinition, Definition::Types : former::FormerDefinitionTypes< Storage = Struct1FormerStorage >,
{

#[ inline( always ) ]
pub fn perform( self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed
{
let result = self.form();
return result;
}

#[ inline( always ) ]
pub fn _new_precise( on_end : Definition::End ) -> Self
{
Self::begin( None, None, on_end )
}

#[ inline( always ) ]
pub fn new< IntoEnd >( end : IntoEnd ) -> Self
where IntoEnd : Into< Definition::End >,
{
Self::begin( None, None, end, )
}

#[ inline( always ) ]
pub fn _begin_precise
(
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
on_end : < Definition as former::FormerDefinition >::End,
) -> Self
)
-> Self
{
if storage.is_none()
{
Expand All @@ -163,14 +171,16 @@ where Definition : former::FormerDefinition, Definition::Types : former::FormerD
on_end : ::core::option::Option::Some( on_end ),
}
}

#[ inline( always ) ]
pub fn begin< IntoEnd >
(
mut storage : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Storage >,
context : core::option::Option< < Definition::Types as former::FormerDefinitionTypes >::Context >,
on_end : IntoEnd,
) -> Self
where IntoEnd : ::core::convert::Into< < Definition as former::FormerDefinition >::End >,
where
IntoEnd : ::core::convert::Into< < Definition as former::FormerDefinition >::End >,
{
if storage.is_none()
{
Expand All @@ -183,11 +193,13 @@ where Definition : former::FormerDefinition, Definition::Types : former::FormerD
on_end : ::core::option::Option::Some( ::core::convert::Into::into( on_end ) ),
}
}

#[ inline( always ) ]
pub fn form( self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed
{
self.end()
}

#[ inline( always ) ]
pub fn end( mut self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed
{
Expand All @@ -206,7 +218,10 @@ where Definition : former::FormerDefinition, Definition::Types : former::FormerD
}

impl< Definition > Struct1Former< Definition >
where Definition : former::FormerDefinition, Definition::Types : former::FormerDefinitionTypes< Storage = Struct1FormerStorage, Formed = Struct1 >, < Definition::Types as former::FormerDefinitionTypes >::Storage : former::StoragePreform,
where
Definition : former::FormerDefinition,
Definition::Types : former::FormerDefinitionTypes< Storage = Struct1FormerStorage, Formed = Struct1 >,
< Definition::Types as former::FormerDefinitionTypes >::Storage : former::StoragePreform,
{
pub fn preform( self ) -> < Definition::Types as former::FormerDefinitionTypes >::Formed
{
Expand Down

0 comments on commit 78c70ad

Please sign in to comment.