Skip to main content

euv_core/vdom/node/
trait.rs

1use crate::*;
2
3/// Trait for types that can be converted into a reactive text `VirtualNode`.
4///
5/// Signals implement this to produce a text node that auto-updates.
6pub(crate) trait AsReactiveText {
7    /// Converts this value into a `VirtualNode::Text` with reactive signal binding.
8    fn as_reactive_text(&self) -> VirtualNode;
9}
10
11/// Trait for converting a value into a `VirtualNode` by consuming it.
12///
13/// Unlike `AsNode` which borrows `&self`, this trait takes ownership,
14/// enabling closures to be wrapped into `DynamicNode` for reactive re-rendering.
15pub trait IntoNode {
16    /// Converts this value into a `VirtualNode` by consuming it.
17    fn into_node(self) -> VirtualNode;
18}