Skip to content

Commit

Permalink
experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 29, 2024
1 parent 844dc44 commit ea514cf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions module/core/former/src/axiomatic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ where
Definition : FormerDefinitionTypes,
{
#[ inline( always ) ]
fn call( &self, storage : Definition::Storage, context : core::option::Option< Definition::Context > ) -> Definition::Formed
fn call( &self, storage : Definition::Storage, _context : core::option::Option< Definition::Context > ) -> Definition::Formed
{
storage.preform()
}
Expand Down Expand Up @@ -126,7 +126,7 @@ where
Definition : FormerDefinitionTypes,
{
#[ inline( always ) ]
fn call( &self, storage : Definition::Storage, _context : core::option::Option< Definition::Context > ) -> Definition::Formed
fn call( &self, _storage : Definition::Storage, _context : core::option::Option< Definition::Context > ) -> Definition::Formed
{
unreachable!();
}
Expand Down
17 changes: 17 additions & 0 deletions module/core/former/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,23 @@ where
on_end : core::option::Option< Definition::End >,
}

// xxx : cover by test
use std::fmt;
impl< E, Definition > fmt::Debug for ContainerSubformer< E, Definition >
where
Definition : FormerDefinition,
< Definition::Types as FormerDefinitionTypes >::Storage : ContainerAdd< Element = E >,
{
fn fmt( &self, f : &mut fmt::Formatter< '_ > ) -> fmt::Result
{
f.debug_struct( "ContainerSubformer" )
.field( "storage", &self.storage.as_ref().map( |_| "Storage Present" ) )
.field( "context", &self.context.as_ref().map( |_| "Context Present" ) )
.field( "on_end", &self.on_end.as_ref().map( |_| "End Present" ) )
.finish()
}
}

impl< E, Definition > ContainerSubformer< E, Definition >
where
Definition : FormerDefinition,
Expand Down
3 changes: 3 additions & 0 deletions module/core/former/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#![ doc( html_root_url = "https://docs.rs/former/latest/former/" ) ]
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]

// xxx : remove
#![ allow( missing_docs ) ]

// xxx : describe "Context-aware forming process"

/// Axiomatic things.
Expand Down
16 changes: 8 additions & 8 deletions module/core/former/tests/inc/former_tests/a_primitives_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ impl Struct1

// = definition

#[ derive( Debug ) ]
#[ derive( Debug, Default ) ]
pub struct Struct1FormerDefinition;

impl Struct1FormerDefinition
{
pub fn new() -> Self
{
Self
}
}
// impl Struct1FormerDefinition
// {
// pub fn new() -> Self
// {
// Self
// }
// }

impl former::FormerDefinitionTypes
for Struct1FormerDefinition
Expand Down
20 changes: 14 additions & 6 deletions module/core/former/tests/inc/former_tests/only_test/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,36 @@ tests_impls!

//

fn descriptor()
fn definition()
{

// descriptor exists and has Formed
// default is implemented for definition
let _default = Struct1FormerDefinition::default();

// definition types exists and has Formed
let got = < Struct1FormerDefinition as the_module::FormerDefinitionTypes >::Formed::former().form();
let exp = Struct1::former().form();
a_id!( got, exp );

// descriptor exists and has Storage
// definition types exists and has Storage
use former::StoragePerform;
let got = < Struct1FormerDefinition as the_module::FormerDefinitionTypes >::Storage::preform( Struct1::former().storage );
let exp = Struct1::former().form();
a_id!( got, exp );

// definition exists and has Storage
let got = < < Struct1FormerDefinition as the_module::FormerDefinition >::Types as the_module::FormerDefinitionTypes >::Formed::former().form();
let exp = Struct1::former().form();
a_id!( got, exp );

}

//

fn storage()
{

// descriptor exists and has Storage
// definition exists and has Storage
let got = < Struct1FormerStorage as the_module::StoragePerform >::preform( Struct1::former().storage );
let exp = Struct1::former().form();
a_id!( got, exp );
Expand All @@ -109,7 +117,7 @@ tests_impls!
let exp = Struct1::former().storage.preform();
a_id!( got, exp );

// descriptor exists and has Storage
// definition exists and has Storage
use former::StoragePerform;
let got = Struct1::former().storage.preform();
let exp = Struct1::former().form();
Expand Down Expand Up @@ -308,7 +316,7 @@ tests_index!
internals,
begin,
preform,
descriptor,
definition,
storage,
test_int,
test_string,
Expand Down

0 comments on commit ea514cf

Please sign in to comment.