1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use wasm_bindgen::JsValue;

use super::Node;

pub struct AnyNode(pub Box<dyn Node>);

impl AnyNode {
    pub fn wrap<N: 'static + Node>(node: N) -> Self {
        Self(Box::new(node))
    }
}

impl Node for AnyNode {
    fn as_react_node_js(&self) -> JsValue {
        self.0.as_react_node_js()
    }
}

pub struct AnyNodeRef<'a>(pub &'a dyn Node);

impl<'a> Node for AnyNodeRef<'a> {
    fn as_react_node_js(&self) -> JsValue {
        self.0.as_react_node_js()
    }
}