mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
wip: tek_test again
This commit is contained in:
parent
fa8282a9d5
commit
4c23aed40a
16 changed files with 190 additions and 172 deletions
|
|
@ -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>>>(
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue