Skip to main content

euv_core/scene/tree/
trait.rs

1use super::*;
2
3/// Target storage that receives a created `NodeId` via `view!` `node_ref:`.
4pub trait NodeRefTarget {
5    /// Stores the mounted `NodeId` handle into this reference target.
6    ///
7    /// # Arguments
8    ///
9    /// - `&Self` - Mutable reference target.
10    /// - `NodeId` - Newly created scene node handle.
11    fn bind_node_ref(&mut self, id: NodeId);
12}
13
14/// Polymorphic text payload trait mounted by `view!` `text { { expr } }` supporting both static strings and reactive closures without emitting consumer-scope imports.
15pub trait TextNodeContent {
16    /// Mounts this static or reactive text payload into `ctx` with `style`.
17    ///
18    /// # Arguments
19    ///
20    /// - `Self` - Text value or reactive producer closure.
21    /// - `&mut Context` - Active scene build context.
22    /// - `Style` - Resolved text style.
23    ///
24    /// # Returns
25    ///
26    /// - `NodeId` - Mounted text scene node handle.
27    fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId;
28}