Merge pull request #711 from Demonthos/realdom-generic-over-custom-types

make the real dom generic over custom types
This commit is contained in:
Jon Kelley authored and GitHub committed 2023-01-03 15:30:13 -05:00
commit 3733ce7332
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(),
@@ -82,7 +82,7 @@ pub enum OwnedAttributeValue<V: FromAnyValue = ()> {
Custom(V),
}
pub trait FromAnyValue {
pub trait FromAnyValue: Clone {
fn from_any_value(value: &dyn AnyValue) -> Self;
}