make tui agnostic over framework

This commit is contained in:
Evan Almloff committed 2023-02-06 21:28:48 -06:00
1 parent 05b968e8e4
commit c805bc25af
18 files changed
+262 -257

No files matched your search

+11
View File
@@ -1,9 +1,12 @@
use std::any::Any;
use std::future::Future;
use std::hash::BuildHasherDefault;
use std::pin::Pin;
pub use node_ref::NodeMask;
pub use passes::AnyMapLike;
pub use passes::{Dependancy, Pass, TypeErasedPass};
use prelude::FromAnyValue;
pub use real_dom::{NodeMut, NodeRef, RealDom};
use rustc_hash::FxHasher;
pub use tree::NodeId;
@@ -31,3 +34,11 @@ pub mod prelude {
pub type FxDashMap<K, V> = dashmap::DashMap<K, V, BuildHasherDefault<FxHasher>>;
pub type FxDashSet<K> = dashmap::DashSet<K, BuildHasherDefault<FxHasher>>;
pub type SendAnyMap = anymap::Map<dyn Any + Send + Sync + 'static>;
pub trait Renderer<V: FromAnyValue + Send + Sync, E> {
fn render(&mut self, root: NodeMut<V>);
fn handle_event(&mut self, node: NodeMut<V>, event: &str, value: E);
fn poll_async(&mut self) -> Pin<Box<dyn Future<Output = ()> + Send>> {
Box::pin(async {})
}
}