Skip to main content

Component

Trait Component 

Source
pub trait Component:
    Lifecycle
    + Sized
    + 'static {
    // Required method
    fn render(&self) -> NodeId;

    // Provided method
    fn mount(self) -> NodeId { ... }
}
Expand description

Core declarative component trait unifying Lifecycle hooks with framework-managed Context rendering.

Required Methods§

Source

fn render(&self) -> NodeId

Renders this component into the ambient framework-managed Context and returns its root NodeId.

§Arguments
  • &Self - Immutable component instance reference.
§Returns
  • NodeId - Root scene node handle produced by rendering.

Provided Methods§

Source

fn mount(self) -> NodeId

Mounts this component through the complete framework lifecycle (on_create -> render -> on_mount) and registers its Lifecycle observer on the mounted node.

§Arguments
  • Self - Owned component instance.
§Returns
  • NodeId - Mounted root scene node handle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Component for DynamicComponentSlot

Component implementation mounting a surgically updatable component slot.

Source§

impl Component for DynamicPageOutlet

Component implementation mounting a reactive route-driven dynamic page outlet.

Source§

impl Component for DynamicPageSlot

Component implementation mounting a surgically updatable page slot for a fixed route.

Source§

impl Component for NodeId

Zero-overhead Component implementation returning an already-mounted NodeId unchanged.