arranger, transport: despaghettify

This commit is contained in:
🪞👃🪞 2024-08-21 20:09:23 +03:00
parent 33bdf65e8d
commit 1104093395
10 changed files with 430 additions and 253 deletions

View file

@ -16,7 +16,7 @@ impl<'a> Render for Collected<'a> {
}
}
pub struct Collection<'a>(Vec<Collected<'a>>);
pub struct Collection<'a>(pub Vec<Collected<'a>>);
impl<'a> Collection<'a> {
pub fn new () -> Self {
@ -27,6 +27,9 @@ impl<'a> Collection<'a> {
pub trait Collect<'a> {
fn add_box (self, item: Box<dyn Render + 'a>) -> Self;
fn add_ref (self, item: &'a dyn Render) -> Self;
fn add <T: Render + Sized + 'a> (self, item: T) -> Self where Self: Sized {
self.add_box(Box::new(item))
}
}
impl<'a> Collect<'a> for Collection<'a> {