use crate::*;
pub struct Reduce(pub PhantomData, pub F, pub G) where
A: Send + Sync, B: Send + Sync,
I: Iterator- + Send + Sync,
F: Fn() -> I + Send + Sync,
G: Fn(A, B, usize)->A + Send + Sync;
impl Reduce where
A: Send + Sync, B: Send + Sync,
I: Iterator
- + Send + Sync,
F: Fn() -> I + Send + Sync,
G: Fn(A, B, usize)->A + Send + Sync
{
pub fn new (f: F, g: G) -> Self { Self(Default::default(), f, g) }
}
impl Content for Reduce where
A: Send + Sync, B: Send + Sync,
I: Iterator
- + Send + Sync,
F: Fn() -> I + Send + Sync,
G: Fn(A, B, usize)->A + Send + Sync
{
fn content (&self) -> impl Render {
}
}
/*
//pub fn reduce (iterator: I, callback: F) -> Reduce where
//E: Output,
//I: Iterator
- + Send + Sync,
//R: Render,
//F: Fn(R, T, usize) -> R + Send + Sync
//{
//Reduce(Default::default(), iterator, callback)
//}
pub struct Reduce(PhantomData<(E, R)>, I, F) where
E: Output,
I: Iterator
- + Send + Sync,
R: Render,
F: Fn(R, T, usize) -> R + Send + Sync;
impl Content for Reduce where
E: Output,
I: Iterator
- + Send + Sync,
R: Render,
F: Fn(R, T, usize) -> R + Send + Sync
{
fn render (&self, to: &mut E) {
todo!()
}
}
*/
//macro_rules! define_ops {
//($Trait:ident<$E:ident:$Output:path> { $(
//$(#[$attr:meta $($attr_args:tt)*])*
//(
//$fn:ident
//$(<$($G:ident$(:$Gen:path)?, )+>)?
//$Op:ident
//($($arg:ident:$Arg:ty),*)
//)
//)* }) => {
//impl<$E: $Output> $Trait for E {}
//pub trait $Trait<$E: $Output> {
//$(
//$(#[$attr $($attr_args)*])*
//fn $fn $(<$($G),+>)?
//($($arg:$Arg),*)-> $Op<$($(, $G)+)?>
//$(where $($G: $($Gen + Send + Sync)?),+)?
//{ $Op($($arg),*) }
//)*
//}
//}
//}
//define_ops! {
//Layout {
//(when ,>
//When(cond: bool, item: A))
///// When `cond` is `true`, render `a`, otherwise render `b`.
//(either , B: Render,>
//Either(cond: bool, a: A, b: B))
///// If `opt` is `Some(T)` renders `cb(t)`, otherwise nothing.
//(opt B, B: Render,>
//Opt(option: Option, cb: F))
///// Maps items of iterator through callback.
//(map , I: Iterator
- , F: Fn() -> I, G: Fn(A, usize)->B,>
//Map(get_iterator: F, callback: G))
//}
//}