wip: migrating to Widget trait

This commit is contained in:
🪞👃🪞 2024-09-09 14:57:14 +03:00
parent b944dd5f9e
commit c4a5ee7b6e
4 changed files with 130 additions and 161 deletions

View file

@ -96,16 +96,12 @@ pub trait Content {
//()
//}
//}
impl<W> Widget for W where W: Content {
type Engine = <Self as Content>::Engine;
fn layout (&self, to: <<Self as Content>::Engine as Engine>::Area)
-> Perhaps<<<Self as Content>::Engine as Engine>::Area>
{
impl<E: Engine, W> Widget for W where W: Content<Engine = E> {
type Engine = E;
fn layout (&self, to: E::Area) -> Perhaps<E::Area> {
self.content().layout(to)
}
fn render (&self, to: &mut <Self as Content>::Engine)
-> Perhaps<<<Self as Content>::Engine as Engine>::Area>
{
fn render (&self, to: &mut E) -> Perhaps<E::Area> {
self.content().render(to)
}
}