mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
halp, i cant write a recursive iterator :3
This commit is contained in:
parent
f3fd88a199
commit
140fd22223
10 changed files with 107 additions and 99 deletions
23
edn/src/edn_view.rs
Normal file
23
edn/src/edn_view.rs
Normal 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, })
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue