#![allow(missing_docs)]
fn main() {
struct Sum;
impl former::FormerDefinitionTypes for Sum {
type Storage = Vec<i32>; type Formed = i32; type Context = (); }
impl former::FormerMutator for Sum {}
impl former::FormerDefinition for Sum {
type Types = Sum; type End = Sum; type Storage = Vec<i32>; type Formed = i32; type Context = (); }
impl former::FormingEnd<Sum> for Sum {
fn call(
&self,
storage: <Sum as former::FormerDefinitionTypes>::Storage,
_context: Option<<Sum as former::FormerDefinitionTypes>::Context>,
) -> <Sum as former::FormerDefinitionTypes>::Formed {
storage.iter().sum()
}
}
let got = former::CollectionFormer::<i32, Sum>::new(Sum)
.add( 1 ) .add( 2 ) .add( 10 ) .form(); let exp = 13; assert_eq!(got, exp);
dbg!(got); }