wip: tek_test again

This commit is contained in:
🪞👃🪞 2024-09-09 22:57:00 +03:00
parent fa8282a9d5
commit 4c23aed40a
16 changed files with 190 additions and 172 deletions

View file

@ -52,7 +52,7 @@ impl<'a, E: Engine> Collect<'a, E> for Collection<'a, E> {
}
}
pub struct Layers<'a, E: Engine>(pub &'a [&'a dyn Widget<Engine = E>]);
pub struct Layers<'a, E: Engine, const N: usize>(pub [&'a dyn Widget<Engine = E>;N]);
// this actually works, except for the type inference
//pub struct Layers<'a, E: Engine + 'a, I: std::iter::IntoIterator<Item = &'a dyn Render<E>>>(

View file

@ -1,6 +1,6 @@
use crate::*;
pub trait Widget {
pub trait Widget: Send + Sync {
type Engine: Engine;
fn layout (&self, to: <<Self as Widget>::Engine as Engine>::Area) ->
Perhaps<<<Self as Widget>::Engine as Engine>::Area>;
@ -71,7 +71,7 @@ impl<E: Engine, W: Widget<Engine = E>> Widget for Option<W> {
}
}
pub trait Content {
pub trait Content: Send + Sync {
type Engine: Engine;
fn content (&self) -> impl Widget<Engine = <Self as Content>::Engine>;
}

View file

@ -53,7 +53,7 @@ impl<'a> Split<'a, Tui> {
}
}
impl<'a> Widget for Layers<'a, Tui> {
impl<'a, const N: usize> Widget for Layers<'a, Tui, N> {
type Engine = Tui;
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
let [x, y, ..] = area;