Skip to main content

euv_core/scene/lifecycle/
impl.rs

1use super::*;
2
3/// No-op `Lifecycle` implementation allowing raw `NodeId` handles to participate seamlessly in `Component` APIs.
4impl Lifecycle for NodeId {}
5
6/// Zero-overhead `Component` implementation returning an already-mounted `NodeId` unchanged.
7impl Component for NodeId {
8    /// Returns this `NodeId` handle unchanged.
9    ///
10    /// # Arguments
11    ///
12    /// - `&Self` - Already-mounted scene node handle.
13    ///
14    /// # Returns
15    ///
16    /// - `NodeId` - Same scene node handle.
17    fn render(&self) -> NodeId {
18        *self
19    }
20
21    /// Returns this `NodeId` directly without heap allocation or duplicate lifecycle attachment.
22    ///
23    /// # Arguments
24    ///
25    /// - `Self` - Already-mounted scene node handle.
26    ///
27    /// # Returns
28    ///
29    /// - `NodeId` - Same scene node handle.
30    fn mount(self) -> NodeId {
31        self
32    }
33}