mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
unify edn_view entrypoint
This commit is contained in:
parent
df50bb9f47
commit
9cd6e9f195
16 changed files with 603 additions and 541 deletions
|
|
@ -4,7 +4,9 @@ use EdnItem::*;
|
|||
pub struct EdnKeymap(pub Vec<EdnItem<String>>);
|
||||
|
||||
impl EdnKeymap {
|
||||
pub fn command <C, D: Command<C>, E: EdnCommand<C>, I: EdnInput> (&self, state: &C, input: &I) -> Option<E> {
|
||||
pub fn command <C, D: Command<C>, E: EdnCommand<C>, I: EdnInput> (
|
||||
&self, state: &C, input: &I
|
||||
) -> Option<E> {
|
||||
for item in self.0.iter() {
|
||||
if let Exp(items) = item {
|
||||
match items.as_slice() {
|
||||
|
|
@ -20,3 +22,13 @@ impl EdnKeymap {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AsRef<str>> From<T> for EdnKeymap {
|
||||
fn from (source: T) -> Self {
|
||||
Self(EdnItem::<String>::read_all(source.as_ref()).expect("failed to load keymap"))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn_keymap () {
|
||||
let keymap = EdnKeymap::from("");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue