make the real dom generic over custom types

This commit is contained in:
Evan Almloff committed 2023-01-03 12:35:48 -06:00
1 parent dde4fb31b2
commit bf20b66b38
5 files changed
+99 -44

No files matched your search

+3 -3
View File
@@ -5,7 +5,7 @@ use std::fmt::Debug;
/// The node is stored client side and stores only basic data about the node.
#[derive(Debug, Clone)]
pub struct Node<S: State, V: FromAnyValue = ()> {
pub struct Node<S: State<V>, V: FromAnyValue + 'static = ()> {
/// The transformed state of the node.
pub state: S,
/// The raw data for the node
@@ -37,7 +37,7 @@ pub enum NodeType<V: FromAnyValue = ()> {
Placeholder,
}
impl<S: State, V: FromAnyValue> Node<S, V> {
impl<S: State<V>, V: FromAnyValue> Node<S, V> {
pub(crate) fn new(node_type: NodeType<V>) -> Self {
Node {
state: S::default(),
@@ -83,7 +83,7 @@ pub enum OwnedAttributeValue<V: FromAnyValue = ()> {
None,
}
pub trait FromAnyValue {
pub trait FromAnyValue: Clone {
fn from_any_value(value: &dyn AnyValue) -> Self;
}