separate render/content macros; add has_jack

This commit is contained in:
🪞👃🪞 2025-01-14 12:41:27 +01:00
parent 08184f9906
commit e62e36d558
19 changed files with 183 additions and 226 deletions

View file

@ -1,4 +1,8 @@
use crate::*;
/// Turns an EDN item sequence into a command enum variant.
pub trait EdnCommand<C>: Command<C> {
fn from_edn <'a> (state: &C, head: &EdnItem<&str>, tail: &'a [EdnItem<String>]) -> Self;
}
/** Implement `EdnCommand` for given `State` and `Command` */
#[macro_export] macro_rules! edn_command {
($Command:ty : |$state:ident:$State:ty| { $((
@ -47,16 +51,3 @@ use crate::*;
let $arg: $type = EdnProvide::<$type>::get_or_fail($state, $arg);
};
}
/// Turns an EDN symbol sequence into a command enum variant.
pub trait EdnCommand<C>: Command<C> {
fn from_edn <'a> (state: &C, head: &EdnItem<&str>, tail: &'a [EdnItem<String>]) -> Self;
fn get_isize (state: &C, item: &EdnItem<&str>) -> Option<isize> {
None
}
fn get_usize (state: &C, item: &EdnItem<&str>) -> Option<usize> {
None
}
fn get_bool (state: &C, item: &EdnItem<&str>) -> Option<usize> {
None
}
}

View file

@ -1,5 +1,4 @@
use crate::*;
use EdnItem::*;
pub trait EdnInput: Input {
fn matches (&self, token: &str) -> bool;