Skip to content

Commit

Permalink
former : experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Apr 30, 2024
1 parent 417d3ff commit 0fbc7e6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
35 changes: 30 additions & 5 deletions module/core/former/src/hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use super::*;
use collection_tools::HashSet;

impl< E > ContainerAdd for collection_tools::HashSet< E >
impl<K > ContainerAdd for collection_tools::HashSet< K >
where
E : core::cmp::Eq + core::hash::Hash,
K : core::cmp::Eq + core::hash::Hash,
{
type Element = E;
type Element = K;

#[ inline( always ) ]
fn add( &mut self, e : Self::Element ) -> bool
Expand Down Expand Up @@ -118,9 +118,34 @@ where

type Types = HashSetDefinition< K, Context, Formed, NoEnd >;
type End = End;
}

// = Entity To

impl< K, Definition > EntityToFormer< Definition > for HashSet< K >
where
K : ::core::cmp::Eq + ::core::hash::Hash,
Definition : FormerDefinition< Storage = HashSet< K >, Formed = () >,
< Definition as definition::FormerDefinition>::End : Fn( HashSet< K >, Option< Definition::Context > ),
{
type Former = HashSetSubformer< K, Definition::Context, Definition::Formed, Definition::End >;
}

// type Types = HashSetDefinition< K, Context, Formed, NoEnd >;
// type End = End;
impl< K > crate::EntityToStorage
for HashSet< K >
where
K : ::core::cmp::Eq + ::core::hash::Hash,
{
type Storage = HashSet< K >;
}

impl< K, Context, Formed, End > crate::EntityToDefinition< Context, Formed, End >
for HashSet< K >
where
K : ::core::cmp::Eq + ::core::hash::Hash,
End : crate::FormingEnd< HashSetDefinition< K, Context, Formed, NoEnd > >,
{
type Definition = HashSetDefinition< K, Context, Formed, End >;
}

// = subformer
Expand Down
2 changes: 2 additions & 0 deletions module/core/former/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ where
type End = End;
}

// = Entity To

// xxx : implement for hashset / hashmap
// xxx : cover by tests
impl< E, Definition > EntityToFormer< Definition > for Vec< E >
Expand Down

0 comments on commit 0fbc7e6

Please sign in to comment.