mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: let's figure out how edn keymaps will work
This commit is contained in:
parent
4ab08e48e5
commit
794d4210c6
33 changed files with 161 additions and 85 deletions
|
|
@ -5,3 +5,6 @@ version = "0.2.0"
|
|||
|
||||
[dependencies]
|
||||
tek_edn = { path = "../edn" }
|
||||
|
||||
[dev-dependencies]
|
||||
tek_tui = { path = "../tui" }
|
||||
|
|
|
|||
0
input/examples/edn-keys.rs
Normal file
0
input/examples/edn-keys.rs
Normal file
0
input/examples/keys00.edn
Normal file
0
input/examples/keys00.edn
Normal file
0
input/examples/keys01.edn
Normal file
0
input/examples/keys01.edn
Normal file
0
input/examples/keys02.edn
Normal file
0
input/examples/keys02.edn
Normal 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>>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue