[][src]Struct alchemy_lifecycle::rsx::VirtualNode

pub struct VirtualNode {
    pub tag: &'static str,
    pub styles: StylesList,
    pub create_component_fn: fn(key: ComponentKey) -> Box<dyn Component>,
    pub props: Box<dyn Any>,
    pub children: Vec<RSX>,
}

A VirtualNode is akin to an Element in React terms. Here, we provide a way for lazy Component instantiation, properties, children and so on.

Fields

tag: &'static str

Used in debugging/printing/etc.

styles: StylesList

Used for determining which CSS styles should be applied to this node. This property is accessed often enough that it's separated out here.

create_component_fn: fn(key: ComponentKey) -> Box<dyn Component>

Component instances are created on-demand, if the reconciler deems it be so. This is a closure that should return an instance of the correct type.

props: Box<dyn Any>

When some RSX is returned, we scoop up the props inside a special block, and then shove them in here as an Any object. When you derive(Props) on a Component struct, it creates a setter that specifically handles downcasting and persisting props for you.

children: Vec<RSX>

Child components for this node.

Trait Implementations

impl Debug for VirtualNode[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Special formatting for debugging nodes.

impl Display for VirtualNode[src]

fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]

Special formatting for displaying nodes.

Auto Trait Implementations

impl !Send for VirtualNode

impl !Sync for VirtualNode

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]