🔥 Refactor TypeId/Any use, drop own Handle

This commit is contained in:
Manuel Cillero 2024-02-16 17:00:34 +01:00
parent 8402b7946e
commit 169e562488
59 changed files with 137 additions and 289 deletions

View file

@ -1,10 +1,10 @@
use crate::core::action::{Action, ActionsList};
use crate::{Handle, LazyStatic};
use crate::{LazyStatic, TypeId};
use std::collections::HashMap;
use std::sync::RwLock;
pub type KeyAction = (Handle, Option<Handle>, Option<String>);
pub type KeyAction = (TypeId, Option<TypeId>, Option<String>);
// Registered actions.
static ACTIONS: LazyStatic<RwLock<HashMap<KeyAction, ActionsList>>> =
@ -13,8 +13,8 @@ static ACTIONS: LazyStatic<RwLock<HashMap<KeyAction, ActionsList>>> =
pub fn add_action(action: Action) {
let mut actions = ACTIONS.write().unwrap();
let key_action = (
action.handle(),
action.referer_handle(),
action.type_id(),
action.referer_type_id(),
action.referer_id(),
);
if let Some(list) = actions.get_mut(&key_action) {