mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
EdnViewData has to go?
This commit is contained in:
parent
ddcb967a2c
commit
585bba6666
6 changed files with 25 additions and 25 deletions
|
|
@ -1,6 +1,19 @@
|
|||
use crate::*;
|
||||
use std::marker::PhantomData;
|
||||
use EdnItem::*;
|
||||
/// Implements `EdnProvide` for content components and expressions
|
||||
#[macro_export] macro_rules! edn_provide_content {
|
||||
(|$self:ident:$Stat:ty|{ $($pat:pat => $expr:expr),* $(,)? }) => {
|
||||
impl<'a> EdnProvide<'a, Box<dyn Render<TuiOut> + 'a>> for $State {
|
||||
fn get <S: AsRef<str>> (&'a $self, edn: &'a EdnItem<S>) -> Option<Box<dyn Render<TuiOut> + 'a>> {
|
||||
Some(match edn.to_ref() {
|
||||
$(EdnItem::Sym($pat) => $expr),*,
|
||||
_ => return None
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Renders from EDN source and context.
|
||||
#[derive(Default)]
|
||||
pub enum EdnView<'a, E: Output, T: EdnViewData<'a, E> + std::fmt::Debug> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue