From b79033ab6d4e601cc050b88ae5b31fea1cc9d59d Mon Sep 17 00:00:00 2001 From: unspeaker Date: Thu, 12 Sep 2024 18:12:59 +0300 Subject: [PATCH] remove old Collect stuff --- crates/tek_core/src/engine.rs | 52 ----------------------------------- 1 file changed, 52 deletions(-) diff --git a/crates/tek_core/src/engine.rs b/crates/tek_core/src/engine.rs index 8b1cad37..8f6bf380 100644 --- a/crates/tek_core/src/engine.rs +++ b/crates/tek_core/src/engine.rs @@ -278,58 +278,6 @@ pub fn handle_keymap ( } } -pub enum Collected<'a, E: Engine> { - Box(Box + 'a>), - Ref(&'a (dyn Widget + 'a)), -} - -impl<'a, E: Engine> Widget for Collected<'a, E> { - type Engine = E; - fn layout (&self, area: E::Area) -> Perhaps { - match self { - Self::Box(inner) => (*inner).layout(area), - Self::Ref(inner) => (*inner).layout(area), - } - } - fn render (&self, to: &mut E) -> Perhaps { - match self { - Self::Box(inner) => (*inner).render(to), - Self::Ref(inner) => (*inner).render(to), - } - } -} - -pub struct Collection<'a, E: Engine>( - pub Vec> -); - -impl<'a, E: Engine> Collection<'a, E> { - pub fn new () -> Self { - Self(vec![]) - } -} - -pub trait Collect<'a, E: Engine> { - fn add_box (self, item: Box + 'a>) -> Self; - fn add_ref (self, item: &'a dyn Widget) -> Self; - fn add + Sized + 'a> (self, item: R) -> Self - where Self: Sized - { - self.add_box(Box::new(item)) - } -} - -impl<'a, E: Engine> Collect<'a, E> for Collection<'a, E> { - fn add_box (mut self, item: Box + 'a>) -> Self { - self.0.push(Collected::Box(item)); - self - } - fn add_ref (mut self, item: &'a dyn Widget) -> Self { - self.0.push(Collected::Ref(item)); - self - } -} - pub struct Split< E: Engine, F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget)->Usually<()>)->Usually<()>