wip: closure-based collections

This commit is contained in:
🪞👃🪞 2024-09-10 02:01:19 +03:00
parent 4c23aed40a
commit 1cbf8de4e4
4 changed files with 72 additions and 56 deletions

View file

@ -54,6 +54,20 @@ impl<'a, E: Engine> Collect<'a, E> for Collection<'a, E> {
pub struct Layers<'a, E: Engine, const N: usize>(pub [&'a dyn Widget<Engine = E>;N]);
pub struct Layers2<
E: Engine,
F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget<Engine = E>)->Usually<()>)->Usually<()>
>(pub F, PhantomData<E>);
impl<
E: Engine,
F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget<Engine = E>)->Usually<()>)->Usually<()>
> Layers2<E, F> {
pub fn new (build: F) -> Self {
Self(build, Default::default())
}
}
// this actually works, except for the type inference
//pub struct Layers<'a, E: Engine + 'a, I: std::iter::IntoIterator<Item = &'a dyn Render<E>>>(
//pub &'a I