halp, i cant write a recursive iterator :3

This commit is contained in:
🪞👃🪞 2025-01-05 03:29:27 +01:00
parent f3fd88a199
commit 140fd22223
10 changed files with 107 additions and 99 deletions

23
edn/src/edn_view.rs Normal file
View file

@ -0,0 +1,23 @@
use crate::*;
use std::marker::PhantomData;
use EdnItem::*;
use EdnItem::*;
/// Renders from EDN source and context.
pub struct EdnView<'a, E: Engine + 'a, T: EdnLayout<'a, E> + 'a> {
_engine: PhantomData<&'a E>,
context: T,
layout: EdnItem<String>
//render: Box<dyn Fn(&'a T)->Box<dyn Render<E> + Send + Sync + 'a> + Send + Sync + 'a>
}
impl<'a, E: Engine + 'a, T: EdnLayout<'a, E> + 'a> EdnView<'a, E, T> {
pub fn new (context: T, source: &'a str) -> Usually<Self> {
let layout = EdnItem::read_one(&source)?.0;
for symbol in layout.symbols() {
context.import(symbol)
}
Ok(Self { _engine: Default::default(), context, layout, })
}
}