diff --git a/module/core/former/src/axiomatic.rs b/module/core/former/src/axiomatic.rs index 3b8cfaef2c..50ed77f42f 100644 --- a/module/core/former/src/axiomatic.rs +++ b/module/core/former/src/axiomatic.rs @@ -20,7 +20,14 @@ pub trait FormerDefinition : Sized type Storage : Storage< Formed = Self::Formed >; type Formed; type Context; - type End : FormingEnd< Self >; + // type End : FormingEnd< Self >; +} + +/// xxx +pub trait FormerDefinition2 : Sized +{ + type Definition : FormerDefinition; + type End : FormingEnd< Self::Definition >; } // pub trait FormerDefinition @@ -92,8 +99,8 @@ pub struct ReturnStorage; impl< Definition, T > FormingEnd< Definition > for ReturnStorage where - Definition : FormerDefinition< Context = (), Storage = T, Formed = T, End = Self >, - Definition::End : FormingEnd< Definition >, + Definition : FormerDefinition< Context = (), Storage = T, Formed = T >, + // Definition::End : FormingEnd< Definition >, // Definition::End : Self, // Definition::Storage : Default, { @@ -180,7 +187,7 @@ for FormingEndWrapper< Definition > /// sequences within builder patterns. // xxx : update description -pub trait FormerBegin< Definition : FormerDefinition > +pub trait FormerBegin< Definition : FormerDefinition2 > { /// * `End` - A trait bound marking the closure or handler invoked upon completing the subforming process. Implementers @@ -188,7 +195,8 @@ pub trait FormerBegin< Definition : FormerDefinition > /// into `Formed`, optionally utilizing `Context` to guide this transformation. It is crucial that this /// associated type satisfies the `FormingEnd< Formed >` trait, defining the precise mechanics of /// how the subformer concludes its operation. - type End : FormingEnd< Definition >; + // type End : FormingEnd< Definition >; + // type End : Definition::End; /// Launches the subforming process with an initial storage and context, setting up an `on_end` completion handler. /// @@ -199,9 +207,9 @@ pub trait FormerBegin< Definition : FormerDefinition > /// * `on_end` - A completion handler responsible for transforming the accumulated `Storage` into the final `Formed` structure. fn _begin ( - storage : core::option::Option< Definition::Storage >, - context : core::option::Option< Definition::Context >, - on_end : Self::End, + storage : core::option::Option< < Definition::Definition as FormerDefinition >::Storage >, + context : core::option::Option< < Definition::Definition as FormerDefinition >::Context >, + on_end : Definition::End, ) -> Self; } diff --git a/module/core/former/src/container.rs b/module/core/former/src/container.rs index a7156befe3..4a72d03220 100644 --- a/module/core/former/src/container.rs +++ b/module/core/former/src/container.rs @@ -194,28 +194,28 @@ where // = /// A builder for constructing containers, facilitating a fluent and flexible interface. -#[ derive( Debug, Default ) ] +#[ derive( Default ) ] pub struct ContainerSubformer< E, Definition > where // End : FormingEnd< Definition >, - Definition : FormerDefinition, - Definition::Storage : ContainerAdd< Element = E >, + Definition : FormerDefinition2, + < Definition::Definition as FormerDefinition >::Storage : ContainerAdd< Element = E >, { - storage : core::option::Option< Definition::Storage >, - context : core::option::Option< Definition::Context >, + storage : core::option::Option< < Definition::Definition as FormerDefinition >::Storage >, + context : core::option::Option< < Definition::Definition as FormerDefinition >::Context >, on_end : core::option::Option< Definition::End >, } impl< E, Definition > ContainerSubformer< E, Definition > where // End : FormingEnd< Definition >, - Definition : FormerDefinition, - Definition::Storage : ContainerAdd< Element = E >, + Definition : FormerDefinition2, + < Definition::Definition as FormerDefinition >::Storage : ContainerAdd< Element = E >, { /// Form current former into target structure. #[ inline( always ) ] - pub fn storage( mut self ) -> Definition::Storage + pub fn storage( mut self ) -> < Definition::Definition as FormerDefinition >::Storage { let storage = if self.storage.is_some() { @@ -233,8 +233,8 @@ where #[ inline( always ) ] pub fn begin ( - storage : core::option::Option< Definition::Storage >, - context : core::option::Option< Definition::Context >, + storage : core::option::Option< < Definition::Definition as FormerDefinition >::Storage >, + context : core::option::Option< < Definition::Definition as FormerDefinition >::Context >, on_end : Definition::End, ) -> Self { @@ -248,7 +248,7 @@ where /// Finalizes the building process, returning the formed or a context incorporating it. #[ inline( always ) ] - pub fn end( mut self ) -> Definition::Formed + pub fn end( mut self ) -> < Definition::Definition as FormerDefinition >::Formed { let on_end = self.on_end.take().unwrap(); let context = self.context.take(); @@ -258,14 +258,14 @@ where /// Finalizes the building process, returning the formed or a context incorporating it. #[ inline( always ) ] - pub fn form( self ) -> Definition::Formed + pub fn form( self ) -> < Definition::Definition as FormerDefinition >::Formed { self.end() } /// Replaces the current storage with a provided one, allowing for a reset or redirection of the building process. #[ inline( always ) ] - pub fn replace( mut self, vector : Definition::Storage ) -> Self + pub fn replace( mut self, vector : < Definition::Definition as FormerDefinition >::Storage ) -> Self { self.storage = Some( vector ); self @@ -273,11 +273,12 @@ where } -impl< E, T, Definition > ContainerSubformer< E, Definition > +impl< E, T, Definition, Definition1 > ContainerSubformer< E, Definition > where - Definition : FormerDefinition< Context = (), Storage = T, Formed = T, End = ReturnStorage >, - Definition::Storage : ContainerAdd< Element = E >, - Definition::Storage : StoragePerform< Formed = Definition::Formed >, + Definition1 : FormerDefinition< Context = (), Storage = T, Formed = T >, + Definition : FormerDefinition2< Definition = Definition1, End = ReturnStorage >, + < Definition::Definition as FormerDefinition >::Storage : ContainerAdd< Element = E >, + < Definition::Definition as FormerDefinition >::Storage : StoragePerform< Formed = < Definition::Definition as FormerDefinition >::Formed >, { /// Initializes a new `ContainerSubformer` instance, starting with an empty formed. @@ -303,8 +304,8 @@ where impl< E, Definition > ContainerSubformer< E, Definition > where // End : FormingEnd< Definition >, - Definition : FormerDefinition, - Definition::Storage : ContainerAdd< Element = E >, + Definition : FormerDefinition2, + < Definition::Definition as FormerDefinition >::Storage : ContainerAdd< Element = E >, { /// Appends an element to the end of the storage, expanding the internal collection. @@ -332,16 +333,16 @@ impl< E, Definition > FormerBegin< Definition > for ContainerSubformer< E, Definition > where // End : FormingEnd< Definition >, - Definition : FormerDefinition, - Definition::Storage : ContainerAdd< Element = E >, + Definition : FormerDefinition2, + < Definition::Definition as FormerDefinition >::Storage : ContainerAdd< Element = E >, { - type End = Definition::End; + // type End = Definition::End; #[ inline( always ) ] fn _begin ( - storage : core::option::Option< Definition::Storage >, - context : core::option::Option< Definition::Context >, + storage : core::option::Option< < Definition::Definition as FormerDefinition >::Storage >, + context : core::option::Option< < Definition::Definition as FormerDefinition >::Context >, on_end : Definition::End, ) -> Self diff --git a/module/core/former/src/hash_map.rs b/module/core/former/src/hash_map.rs index e3134e65ee..293cfe2d19 100644 --- a/module/core/former/src/hash_map.rs +++ b/module/core/former/src/hash_map.rs @@ -1,143 +1,143 @@ -use super::*; - -use collection_tools::HashMap; - -/// A trait for types that behave like hash maps, supporting insertion and custom forming behaviors. -/// -/// This trait allows for generic operations on hash map-like data structures, enabling the insertion -/// of key-value pairs and the creation of formers for more complex construction patterns. -/// -/// # Type Parameters -/// - `K`: The type of keys stored in the hash map. Must implement `Eq` and `Hash`. -/// - `E`: The type of elements (values) stored in the hash map. -pub trait HashMapLike< K, E > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - Self : Sized + Default, -{ - - /// Inserts a key-value pair into the map. - fn insert( &mut self, k : K, e : E ) -> Option< E >; - - // /// Return former. - // #[ inline( always ) ] - // fn former< Definition : FormerDefinition >( self ) - // -> - // HashMapSubformer< K, E, Definition, (), impl FormingEnd< Self, Self > > - // { - // HashMapSubformer::begin( Some( self ), None, ReturnFormed ) - // } - // xxx : uncomment and cover by tests - -} - -impl< K, E > HashMapLike< K, E > for HashMap< K, E > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - Self : Sized + Default, -{ - - #[ inline( always ) ] - fn insert( &mut self, k : K, e : E ) -> Option< E > - { - HashMap::insert( self, k, e ) - } - -} - -// = storage - -impl< K, E > Storage -for HashMap< K, E > -where - K : ::core::cmp::Eq + ::core::hash::Hash, -{ - // type Definition = HashMapDefinition< K, E >; - type Formed = HashMap< K, E >; -} - -impl< K, E > StoragePerform -for HashMap< K, E > -where - K : ::core::cmp::Eq + ::core::hash::Hash, -{ - // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed - fn preform( self ) -> Self::Formed - { - self - } -} - -// = definition - -#[ derive( Debug ) ] -pub struct HashMapDefinition< K, E, Context, End > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - End : FormingEnd< Self >, -{ - _phantom : ::core::marker::PhantomData< ( K, E, Context, End ) >, -} - -impl< K, E, Context, End > HashMapDefinition< K, E, Context, End > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - End : FormingEnd< Self >, -{ - pub fn new() -> Self - { - Self { _phantom : ::core::marker::PhantomData } - } -} - -impl< K, E, Context, End > FormerDefinition -for HashMapDefinition< K, E, Context, End > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - End : FormingEnd< Self >, -{ - type Storage = HashMap< K, E >; - type Formed = HashMap< K, E >; - type Context = Context; - type End = End; -} - -/// A builder for constructing hash map-like structures with a fluent interface. -/// -/// `HashMapSubformer` leverages the `HashMapLike` trait to enable a flexible and customizable -/// way to build hash map-like structures. It supports the chaining of insert operations and -/// allows for the definition of custom end actions to finalize the building process. -/// -/// # Type Parameters -/// - `K`: Key type, must implement `Eq` and `Hash`. -/// - `E`: Element (value) type. -/// - `Formed`: The hash map-like formed being built. -/// - `Context`: Type of the optional context used during the building process. -/// - `End`: End-of-forming action to be executed upon completion. -/// -/// # Examples -/// ``` -/// # #[ cfg( all( feature = "enabled", not( feature = "no_std" ) ) ) ] -/// # { -/// # use test_tools::exposed::*; -/// -/// #[ derive( Debug, PartialEq, former::Former ) ] -/// pub struct StructWithMap -/// { -/// #[ subformer( former::HashMapSubformer ) ] -/// map : std::collections::HashMap< &'static str, &'static str >, -/// } -/// -/// let struct1 = StructWithMap::former() -/// .map() -/// .insert( "a", "b" ) -/// .insert( "c", "d" ) -/// .end() -/// .form() -/// ; -/// assert_eq!( struct1, StructWithMap { map : hmap!{ "a" => "b", "c" => "d" } } ); -/// -/// # } -/// ``` - -pub type HashMapSubformer< K, E, Context, End > = ContainerSubformer::< ( K, E ), HashMapDefinition< K, E, Context, End > >; +// use super::*; +// +// use collection_tools::HashMap; +// +// /// A trait for types that behave like hash maps, supporting insertion and custom forming behaviors. +// /// +// /// This trait allows for generic operations on hash map-like data structures, enabling the insertion +// /// of key-value pairs and the creation of formers for more complex construction patterns. +// /// +// /// # Type Parameters +// /// - `K`: The type of keys stored in the hash map. Must implement `Eq` and `Hash`. +// /// - `E`: The type of elements (values) stored in the hash map. +// pub trait HashMapLike< K, E > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// Self : Sized + Default, +// { +// +// /// Inserts a key-value pair into the map. +// fn insert( &mut self, k : K, e : E ) -> Option< E >; +// +// // /// Return former. +// // #[ inline( always ) ] +// // fn former< Definition : FormerDefinition >( self ) +// // -> +// // HashMapSubformer< K, E, Definition, (), impl FormingEnd< Self, Self > > +// // { +// // HashMapSubformer::begin( Some( self ), None, ReturnFormed ) +// // } +// // xxx : uncomment and cover by tests +// +// } +// +// impl< K, E > HashMapLike< K, E > for HashMap< K, E > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// Self : Sized + Default, +// { +// +// #[ inline( always ) ] +// fn insert( &mut self, k : K, e : E ) -> Option< E > +// { +// HashMap::insert( self, k, e ) +// } +// +// } +// +// // = storage +// +// impl< K, E > Storage +// for HashMap< K, E > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// { +// // type Definition = HashMapDefinition< K, E >; +// type Formed = HashMap< K, E >; +// } +// +// impl< K, E > StoragePerform +// for HashMap< K, E > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// { +// // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed +// fn preform( self ) -> Self::Formed +// { +// self +// } +// } +// +// // = definition +// +// #[ derive( Debug ) ] +// pub struct HashMapDefinition< K, E, Context, End > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// End : FormingEnd< Self >, +// { +// _phantom : ::core::marker::PhantomData< ( K, E, Context, End ) >, +// } +// +// impl< K, E, Context, End > HashMapDefinition< K, E, Context, End > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// End : FormingEnd< Self >, +// { +// pub fn new() -> Self +// { +// Self { _phantom : ::core::marker::PhantomData } +// } +// } +// +// impl< K, E, Context, End > FormerDefinition +// for HashMapDefinition< K, E, Context, End > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// End : FormingEnd< Self >, +// { +// type Storage = HashMap< K, E >; +// type Formed = HashMap< K, E >; +// type Context = Context; +// type End = End; +// } +// +// /// A builder for constructing hash map-like structures with a fluent interface. +// /// +// /// `HashMapSubformer` leverages the `HashMapLike` trait to enable a flexible and customizable +// /// way to build hash map-like structures. It supports the chaining of insert operations and +// /// allows for the definition of custom end actions to finalize the building process. +// /// +// /// # Type Parameters +// /// - `K`: Key type, must implement `Eq` and `Hash`. +// /// - `E`: Element (value) type. +// /// - `Formed`: The hash map-like formed being built. +// /// - `Context`: Type of the optional context used during the building process. +// /// - `End`: End-of-forming action to be executed upon completion. +// /// +// /// # Examples +// /// ``` +// /// # #[ cfg( all( feature = "enabled", not( feature = "no_std" ) ) ) ] +// /// # { +// /// # use test_tools::exposed::*; +// /// +// /// #[ derive( Debug, PartialEq, former::Former ) ] +// /// pub struct StructWithMap +// /// { +// /// #[ subformer( former::HashMapSubformer ) ] +// /// map : std::collections::HashMap< &'static str, &'static str >, +// /// } +// /// +// /// let struct1 = StructWithMap::former() +// /// .map() +// /// .insert( "a", "b" ) +// /// .insert( "c", "d" ) +// /// .end() +// /// .form() +// /// ; +// /// assert_eq!( struct1, StructWithMap { map : hmap!{ "a" => "b", "c" => "d" } } ); +// /// +// /// # } +// /// ``` +// +// pub type HashMapSubformer< K, E, Context, End > = ContainerSubformer::< ( K, E ), HashMapDefinition< K, E, Context, End > >; diff --git a/module/core/former/src/hash_set.rs b/module/core/former/src/hash_set.rs index 1f9c63836e..d2a156e166 100644 --- a/module/core/former/src/hash_set.rs +++ b/module/core/former/src/hash_set.rs @@ -1,125 +1,125 @@ -//! # HashSetLike Trait and HashSetSubformer Struct -//! -//! This part of the crate provides a flexible interface (`HashSetLike`) and a builder pattern implementation (`HashSetSubformer`) for `HashSet`-like containers. It's designed to extend the builder pattern, allowing for fluent and dynamic construction of sets within custom data structures. - -use super::*; -use collection_tools::HashSet; - -/// A trait for containers behaving like a `HashSet`, allowing insertion operations. -/// -/// Implementing this trait enables the associated formed to be used with `HashSetSubformer`, -/// facilitating a builder pattern that is both intuitive and concise. -/// -/// # Example Implementation -/// -/// Implementing `HashSetLike` for `std::collections::HashSet`: -/// - -pub trait HashSetLike< K > -where - K : core::cmp::Eq + core::hash::Hash, -{ - /// Inserts a key-value pair into the map. - fn insert( &mut self, element : K ) -> Option< K >; -} - -impl< K > HashSetLike< K > for HashSet< K > -where - K : core::cmp::Eq + core::hash::Hash, -{ - fn insert( &mut self, element : K ) -> Option< K > - { - HashSet::replace( self, element ) - } -} - -// = storage - -impl< K > Storage -for HashSet< K > -where - K : ::core::cmp::Eq + ::core::hash::Hash, -{ - // type Definition = HashSetDefinition< K >; - type Formed = HashSet< K >; -} - -impl< K > StoragePerform -for HashSet< K > -where - K : ::core::cmp::Eq + ::core::hash::Hash, -{ - // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed - fn preform( self ) -> Self::Formed - { - self - } -} - -// = definition - -#[ derive( Debug ) ] -pub struct HashSetDefinition< K, Context, End > -where - K : ::core::cmp::Eq + ::core::hash::Hash, - End : FormingEnd< Self >, -{ - _phantom : ::core::marker::PhantomData< ( 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 > 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 End = End; -} - -/// Facilitates building `HashSetLike` containers with a fluent API. -/// -/// `HashSetSubformer` leverages the `HashSetLike` trait to enable a concise and expressive way -/// of populating `HashSet`-like containers. It exemplifies the crate's builder pattern variation for sets. -/// -/// # Example Usage -/// -/// Using `HashSetSubformer` to populate a `HashSet` within a struct: -/// -/// ```rust -/// # #[ cfg( all( feature = "enabled", not( feature = "no_std" ) ) ) ] -/// # { -/// # use test_tools::exposed::*; -/// -/// #[ derive( Debug, PartialEq, former::Former ) ] -/// pub struct StructWithSet -/// { -/// #[ subformer( former::HashSetSubformer ) ] -/// set : std::collections::HashSet< &'static str >, -/// } -/// -/// let instance = StructWithSet::former() -/// .set() -/// .insert( "apple" ) -/// .insert( "banana" ) -/// .end() -/// .form(); -/// -/// assert_eq!(instance, StructWithSet { set : hset![ "apple", "banana" ] }); -/// # } -/// ``` - -pub type HashSetSubformer< K, Context, End > = ContainerSubformer::< K, HashSetDefinition< K, Context, End > >; +// //! # HashSetLike Trait and HashSetSubformer Struct +// //! +// //! This part of the crate provides a flexible interface (`HashSetLike`) and a builder pattern implementation (`HashSetSubformer`) for `HashSet`-like containers. It's designed to extend the builder pattern, allowing for fluent and dynamic construction of sets within custom data structures. +// +// use super::*; +// use collection_tools::HashSet; +// +// /// A trait for containers behaving like a `HashSet`, allowing insertion operations. +// /// +// /// Implementing this trait enables the associated formed to be used with `HashSetSubformer`, +// /// facilitating a builder pattern that is both intuitive and concise. +// /// +// /// # Example Implementation +// /// +// /// Implementing `HashSetLike` for `std::collections::HashSet`: +// /// +// +// pub trait HashSetLike< K > +// where +// K : core::cmp::Eq + core::hash::Hash, +// { +// /// Inserts a key-value pair into the map. +// fn insert( &mut self, element : K ) -> Option< K >; +// } +// +// impl< K > HashSetLike< K > for HashSet< K > +// where +// K : core::cmp::Eq + core::hash::Hash, +// { +// fn insert( &mut self, element : K ) -> Option< K > +// { +// HashSet::replace( self, element ) +// } +// } +// +// // = storage +// +// impl< K > Storage +// for HashSet< K > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// { +// // type Definition = HashSetDefinition< K >; +// type Formed = HashSet< K >; +// } +// +// impl< K > StoragePerform +// for HashSet< K > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// { +// // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed +// fn preform( self ) -> Self::Formed +// { +// self +// } +// } +// +// // = definition +// +// #[ derive( Debug ) ] +// pub struct HashSetDefinition< K, Context, End > +// where +// K : ::core::cmp::Eq + ::core::hash::Hash, +// End : FormingEnd< Self >, +// { +// _phantom : ::core::marker::PhantomData< ( 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 > 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 End = End; +// } +// +// /// Facilitates building `HashSetLike` containers with a fluent API. +// /// +// /// `HashSetSubformer` leverages the `HashSetLike` trait to enable a concise and expressive way +// /// of populating `HashSet`-like containers. It exemplifies the crate's builder pattern variation for sets. +// /// +// /// # Example Usage +// /// +// /// Using `HashSetSubformer` to populate a `HashSet` within a struct: +// /// +// /// ```rust +// /// # #[ cfg( all( feature = "enabled", not( feature = "no_std" ) ) ) ] +// /// # { +// /// # use test_tools::exposed::*; +// /// +// /// #[ derive( Debug, PartialEq, former::Former ) ] +// /// pub struct StructWithSet +// /// { +// /// #[ subformer( former::HashSetSubformer ) ] +// /// set : std::collections::HashSet< &'static str >, +// /// } +// /// +// /// let instance = StructWithSet::former() +// /// .set() +// /// .insert( "apple" ) +// /// .insert( "banana" ) +// /// .end() +// /// .form(); +// /// +// /// assert_eq!(instance, StructWithSet { set : hset![ "apple", "banana" ] }); +// /// # } +// /// ``` +// +// pub type HashSetSubformer< K, Context, End > = ContainerSubformer::< K, HashSetDefinition< K, Context, End > >; diff --git a/module/core/former/src/vector.rs b/module/core/former/src/vector.rs index 99132431a6..a928b06e29 100644 --- a/module/core/former/src/vector.rs +++ b/module/core/former/src/vector.rs @@ -1,83 +1,83 @@ -use super::*; -use axiomatic::*; - -#[ allow( unused ) ] -use collection_tools::Vec; - -/// Trait for containers that behave like a vector, providing an interface for element addition. -/// -/// This trait enables the use of custom or standard vector-like containers within the builder pattern, -/// allowing for a unified and flexible approach to constructing collections. -/// -pub trait VectorLike< E > -{ - /// Appends an element to the back of a storage. - fn push( &mut self, element : E ); -} - -impl< E > VectorLike< E > for Vec< E > -{ - fn push( &mut self, element : E ) - { - Vec::push( self, element ); - } -} - +// use super::*; +// use axiomatic::*; // - -impl< E > Storage -for Vec< E > -{ - // type Definition = VectorDefinition< E >; - type Formed = Vec< E >; -} - -impl< E > StoragePerform -for Vec< E > -{ - // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed - fn preform( self ) -> Self::Formed - { - self - } -} - +// #[ allow( unused ) ] +// use collection_tools::Vec; // - -#[ derive( Debug ) ] -// pub struct VectorDefinition< E, Context = (), End = ReturnStorage > -pub struct VectorDefinition< E, Context, End > -where - End : FormingEnd< Self >, - Self : FormerDefinition, -{ - _phantom : core::marker::PhantomData< ( E, Context, End ) >, -} - -impl< E, Context, End > VectorDefinition< E, Context, End > -where - End : FormingEnd< Self > -{ - pub fn new() -> Self - { - Self { _phantom : core::marker::PhantomData } - } -} - -impl< E, Context, End > FormerDefinition -for VectorDefinition< E, Context, End > -where - End : FormingEnd< Self > -{ - type Storage = Vec< E >; - type Formed = Vec< E >; - type Context = Context; - type End = End; -} - -/// A builder for constructing `VectorLike` containers, facilitating a fluent and flexible interface. -/// -/// `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, End > = ContainerSubformer::< E, VectorDefinition< E, Context, End > >; +// /// Trait for containers that behave like a vector, providing an interface for element addition. +// /// +// /// This trait enables the use of custom or standard vector-like containers within the builder pattern, +// /// allowing for a unified and flexible approach to constructing collections. +// /// +// pub trait VectorLike< E > +// { +// /// Appends an element to the back of a storage. +// fn push( &mut self, element : E ); +// } +// +// impl< E > VectorLike< E > for Vec< E > +// { +// fn push( &mut self, element : E ) +// { +// Vec::push( self, element ); +// } +// } +// +// // +// +// impl< E > Storage +// for Vec< E > +// { +// // type Definition = VectorDefinition< E >; +// type Formed = Vec< E >; +// } +// +// impl< E > StoragePerform +// for Vec< E > +// { +// // fn preform( self ) -> < < Self as Storage >::Definition as FormerDefinition >::Formed +// fn preform( self ) -> Self::Formed +// { +// self +// } +// } +// +// // +// +// #[ derive( Debug ) ] +// // pub struct VectorDefinition< E, Context = (), End = ReturnStorage > +// pub struct VectorDefinition< E, Context, End > +// where +// End : FormingEnd< Self >, +// Self : FormerDefinition, +// { +// _phantom : core::marker::PhantomData< ( E, Context, End ) >, +// } +// +// impl< E, Context, End > VectorDefinition< E, Context, End > +// where +// End : FormingEnd< Self > +// { +// pub fn new() -> Self +// { +// Self { _phantom : core::marker::PhantomData } +// } +// } +// +// impl< E, Context, End > FormerDefinition +// for VectorDefinition< E, Context, End > +// where +// End : FormingEnd< Self > +// { +// type Storage = Vec< E >; +// type Formed = Vec< E >; +// type Context = Context; +// type End = End; +// } +// +// /// A builder for constructing `VectorLike` containers, facilitating a fluent and flexible interface. +// /// +// /// `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, End > = ContainerSubformer::< E, VectorDefinition< E, Context, End > >;