use { crate::{ CritDestroyListener, CritMatcherId, FixedRootMatcher, crit_leaf::CritLeafEvent, crit_matchers::critm_constant::CritMatchConstant, }, jay_utils::{copyhashmap::CopyHashMap, queue::AsyncQueue}, std::{ hash::Hash, rc::{Rc, Weak}, }, }; pub trait CritMgr: 'static { type Target: CritTarget; fn id(&self) -> CritMatcherId; fn leaf_events(&self) -> &Rc>>; fn match_constant(&self) -> &FixedRootMatcher>; fn roots(&self) -> &Rc<::RootMatchers>; } pub trait CritTarget: 'static { type Id: Copy + Hash + Eq; type Mgr: CritMgr; type RootMatchers; type LeafData: Copy + Eq; type Owner: WeakCritTargetOwner; fn owner(&self) -> Self::Owner; fn id(&self) -> Self::Id; fn destroyed(&self) -> &CopyHashMap>>; fn leaf_data(&self) -> Self::LeafData; } pub trait CritTargetOwner: 'static { type Target: CritTarget; fn data(&self) -> &Self::Target; } pub trait WeakCritTargetOwner: 'static { type Target: CritTarget; type Owner: CritTargetOwner; fn upgrade(&self) -> Option; }