mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 21:26:43 +01:00
wip: closure-based collections
This commit is contained in:
parent
4c23aed40a
commit
1cbf8de4e4
4 changed files with 72 additions and 56 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue