wip: let's figure out how edn keymaps will work

This commit is contained in:
🪞👃🪞 2025-01-12 13:01:15 +01:00
parent 4ab08e48e5
commit 794d4210c6
33 changed files with 161 additions and 85 deletions

View file

@ -5,3 +5,6 @@ version = "0.2.0"
[dependencies]
tek_edn = { path = "../edn" }
[dev-dependencies]
tek_tui = { path = "../tui" }

View file

View file

View file

View file

View file

@ -5,10 +5,22 @@ use std::marker::PhantomData;
/// 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
}
}
pub trait EdnInput: Input {
fn matches (&self, token: &str) -> bool;
fn get_event <S: AsRef<str>> (_: &EdnItem<S>) -> Option<Self::Event> {
None
}
}
pub struct EdnKeymap(pub Vec<EdnItem<String>>);