Start working on command_palette2

This commit is contained in:
Piotr Osiewicz 2023-11-09 17:54:05 +01:00
parent ad3b0bd227
commit d184e0d426
11 changed files with 822 additions and 156 deletions

View file

@ -4,7 +4,7 @@ use collections::{HashMap, HashSet};
use lazy_static::lazy_static;
use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard};
use serde::Deserialize;
use std::any::{type_name, Any};
use std::any::{type_name, Any, TypeId};
/// Actions are used to implement keyboard-driven UI.
/// When you declare an action, you can bind keys to the action in the keymap and
@ -100,6 +100,11 @@ where
}
}
impl dyn Action {
pub fn type_id(&self) -> TypeId {
self.as_any().type_id()
}
}
type ActionBuilder = fn(json: Option<serde_json::Value>) -> anyhow::Result<Box<dyn Action>>;
lazy_static! {