Skip to content

Commit

Permalink
experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 26, 2024
1 parent f86a176 commit f3d6aa2
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 46 deletions.
76 changes: 60 additions & 16 deletions module/core/former/src/hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,50 @@
//
// // = definition
//
// #[ derive( Debug ) ]
// pub struct HashSetDefinition< K, Context, End >
// where
// K : ::core::cmp::Eq + ::core::hash::Hash,
// End : FormingEnd< Self >,
// // #[ derive( Debug, Default ) ]
// // pub struct HashSetDefinition< K, Context, End >
// // where
// // K : ::core::cmp::Eq + ::core::hash::Hash,
// // End : FormingEnd< Self >,
// // {
// // _phantom : ::core::marker::PhantomData< ( K, Context, End ) >,
// // }
//
// #[ derive( Debug, Default ) ]
// pub struct HashSetDefinition< K, Context = (), Formed = HashSet< K >, End = ReturnStorage >
// {
// _phantom : ::core::marker::PhantomData< ( K, Context, End ) >,
// _phantom : core::marker::PhantomData< ( K, Context, Formed, End ) >,
// }
//
// impl< K, Context, End > HashSetDefinition< K, Context, End >
// // impl< K, Context, End > HashSetDefinition< K, Context, End >
// // where
// // K : ::core::cmp::Eq + ::core::hash::Hash,
// // End : FormingEnd< Self >,
// // {
// // pub fn new() -> Self
// // {
// // Self { _phantom : ::core::marker::PhantomData }
// // }
// // }
//
// impl< K, Context, End > FormerDefinitionTypes
// for HashSetDefinition< K, Context, End >
// where
// K : ::core::cmp::Eq + ::core::hash::Hash,
// End : FormingEnd< Self >,
// {
// pub fn new() -> Self
// {
// Self { _phantom : ::core::marker::PhantomData }
// }
// type Storage = HashSet< K >;
// type Formed = HashSet< K >;
// type Context = Context;
// }
//
// impl< K, Context, End > FormerDefinitionTypes
// impl< K, Context, End > FormerDefinition
// for HashSetDefinition< K, Context, End >
// where
// K : ::core::cmp::Eq + ::core::hash::Hash,
// End : FormingEnd< Self >,
// {
// type Storage = HashSet< K >;
// type Formed = HashSet< K >;
// type Context = Context;
// type Types = HashSetDefinition< K, Context, End >;
// type End = End;
// }
//
Expand Down Expand Up @@ -122,4 +137,33 @@
// /// # }
// /// ```
//
// pub type HashSetSubformer< K, Context, End > = ContainerSubformer::< K, HashSetDefinition< K, Context, End > >;
// // xxx : update documentation
// // pub type HashSetSubformer< K, Context, End > = ContainerSubformer::< K, HashSetDefinition< K, Context, End > >;
// pub type HashSetSubformer< K, Context, Formed, End > =
// ContainerSubformer::< K, HashSetDefinition< K, Context, Formed, End > >;
//
// // = extension
//
// pub trait HashSetExt< K > : sealed::Sealed
// where
// K : ::core::cmp::Eq + ::core::hash::Hash,
// {
// fn former() -> HashSetSubformer< K, (), HashSet< K >, ReturnStorage >;
// }
//
// impl< K > HashSetExt< K > for HashSet< K >
// where
// K : ::core::cmp::Eq + ::core::hash::Hash,
// {
// fn former() -> HashSetSubformer< K, (), HashSet< K >, ReturnStorage >
// {
// HashSetSubformer::< K, (), HashSet< K >, ReturnStorage >::new( ReturnStorage::default() )
// }
// }
//
// mod sealed
// {
// use super::HashSet;
// pub trait Sealed {}
// impl< K > Sealed for HashSet< K > {}
// }
42 changes: 13 additions & 29 deletions module/core/former/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ for Vec< E >

// = definition

#[ derive( Debug ) ]
#[ derive( Debug, Default ) ]
pub struct VectorDefinition< E, Context = (), Formed = Vec< E >, End = ReturnStorage >
// where
// Self : FormerDefinitionTypes,
{
_phantom : core::marker::PhantomData< ( E, Context, Formed, End ) >,
}

impl< E, Context, Formed > VectorDefinition< E, Context, Formed >
{
pub fn new() -> Self
{
Self { _phantom : core::marker::PhantomData }
}
}
// impl< E, Context, Formed > VectorDefinition< E, Context, Formed >
// {
// pub fn new() -> Self
// {
// Self { _phantom : core::marker::PhantomData }
// }
// }

impl< E, Context, Formed > FormerDefinitionTypes
for VectorDefinition< E, Context, Formed >
Expand All @@ -66,24 +64,6 @@ for VectorDefinition< E, Context, Formed >
type Context = Context;
}

// #[ derive( Debug ) ]
// pub struct VectorDefinition< E, Context = (), Formed = Vec< E >, End = ReturnStorage >
// where
// End : FormingEnd< VectorDefinition< E, Context, Formed > >,
// {
// _phantom : core::marker::PhantomData< ( E, Context, Formed, End ) >,
// }

// impl< E, Context, Formed, End > VectorDefinition< E, Context, Formed, End >
// where
// End : FormingEnd< VectorDefinition< E, Context, Formed > >,
// {
// pub fn new() -> Self
// {
// Self { _phantom : core::marker::PhantomData }
// }
// }

impl< E, Context, Formed, End > FormerDefinition
for VectorDefinition< E, Context, Formed, End >
where
Expand All @@ -100,7 +80,10 @@ where
/// `VectorSubformer` leverages the `VectorLike` trait to enable the construction and manipulation
/// of vector-like containers in a builder pattern style, promoting readability and ease of use.

pub type VectorSubformer< E, Context, Formed, End > = ContainerSubformer::< E, VectorDefinition< E, Context, Formed, End > >;
// xxx : update documentation

pub type VectorSubformer< E, Context, Formed, End > =
ContainerSubformer::< E, VectorDefinition< E, Context, Formed, End > >;

// = extension

Expand All @@ -119,6 +102,7 @@ impl< E > VecExt< E > for Vec< E >

mod sealed
{
use super::Vec;
pub trait Sealed {}
impl< E > Sealed for Vec< E > {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use super::*;
#[ allow( unused_imports ) ]
use collection_tools::HashSet;


// qqq : zzz : remove #[ cfg( not( feature = "use_alloc" ) ) ]
#[ cfg( not( feature = "use_alloc" ) ) ]
#[ test ]
Expand Down

0 comments on commit f3d6aa2

Please sign in to comment.