Skip to main content

NodeBlueprint

Enum NodeBlueprint 

Source
pub enum NodeBlueprint {
    Element {
        tag: Tag,
        classes: ClassList,
        attributes: Vec<Attribute>,
        children: Vec<NodeBlueprint>,
    },
    Text(String),
    DynamicText(Rc<dyn Fn() -> String>),
    Fragment(Vec<NodeBlueprint>),
    Empty,
}
Expand description

Core reactive blueprint tree representation.

Variants§

§

Element

Fields

§tag: Tag
§classes: ClassList
§attributes: Vec<Attribute>
§children: Vec<NodeBlueprint>
§

Text(String)

§

DynamicText(Rc<dyn Fn() -> String>)

§

Fragment(Vec<NodeBlueprint>)

§

Empty

Implementations§

Source§

impl NodeBlueprint

Source

pub fn element( tag: Tag, classes: impl Into<ClassList>, attributes: Vec<Attribute>, children: Vec<NodeBlueprint>, ) -> NodeBlueprint

Source

pub fn element_simple( tag: Tag, classes: impl Into<ClassList>, children: Vec<NodeBlueprint>, ) -> NodeBlueprint

Source

pub fn text(content: impl Into<String>) -> NodeBlueprint

Source

pub fn dynamic_text(f: impl Fn() -> String + 'static) -> NodeBlueprint

Source

pub fn fragment(children: Vec<NodeBlueprint>) -> NodeBlueprint

Source

pub fn empty() -> NodeBlueprint

Source

pub fn entity_id(&self) -> Option<EntityId>

Returns the EntityId assigned to this blueprint element if present.

Source

pub fn with_entity_id(self, entity_id: EntityId) -> NodeBlueprint

Assigns or overrides the EntityId for an Element node blueprint.

Source

pub fn set_entity_id(&mut self, entity_id: EntityId)

Mutably assigns or overrides the EntityId for an Element node blueprint.

Source

pub fn ensure_entity_ids(&mut self)

Iteratively ensures all Element nodes in this blueprint tree have a valid EntityId without consuming call-stack frames on deeply nested trees.

Source

pub fn find_by_entity_id(&self, target_id: EntityId) -> Option<&NodeBlueprint>

Iteratively locates an element blueprint node by its EntityId (O(1) call stack).

Source

pub fn find_by_entity_id_mut( &mut self, target_id: EntityId, ) -> Option<&mut NodeBlueprint>

Iteratively locates a mutable element blueprint node by its EntityId (O(1) call stack).

Source

pub fn dom_uid(&self) -> Option<u64>

Returns the DOM node UID from a data-strata-node-uid attribute if present.

Source

pub fn find_by_dom_uid(&self, target_uid: u64) -> Option<&NodeBlueprint>

Iteratively locates an element blueprint node by its DOM node UID (O(1) call stack).

Source

pub fn find_by_dom_uid_mut( &mut self, target_uid: u64, ) -> Option<&mut NodeBlueprint>

Iteratively locates a mutable element blueprint node by its DOM node UID (O(1) call stack).

Source

pub fn find_path_by_dom_uid(&self, target_uid: u64) -> Option<Vec<usize>>

Iteratively calculates the index path to the element blueprint node with matching DOM node UID (O(1) call stack).

Source

pub fn find_path_by_entity_id(&self, target_id: EntityId) -> Option<Vec<usize>>

Iteratively calculates the index path to the element blueprint node with matching EntityId (O(1) call stack).

Source

pub fn flatten_fragments(self) -> NodeBlueprint

Iteratively flattens nested Fragment nodes within Element children, splicing fragment children directly into their parent elements without deep recursion.

Source

pub fn compile_to_ir(&self, graph: &mut UiIrGraph) -> NodeId

Compiles this reactive blueprint tree into a contiguous 64-byte aligned UiIrGraph.

Trait Implementations§

Source§

impl Clone for NodeBlueprint

Source§

fn clone(&self) -> NodeBlueprint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeBlueprint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for NodeBlueprint

Source§

fn default() -> NodeBlueprint

Returns the “default value” for a type. Read more
Source§

impl Drop for NodeBlueprint

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl IntoChildren<NodeBlueprint> for NodeBlueprint

Source§

impl IntoChildren<NodeBlueprint> for View

Source§

impl IntoChildren<NodeBlueprint> for Vec<NodeBlueprint>

Source§

impl IntoChildren<Option<NodeBlueprint>> for NodeBlueprint

Source§

impl IntoChildren<Option<Vec<NodeBlueprint>>> for NodeBlueprint

Source§

impl IntoChildren<Option<View>> for NodeBlueprint

Source§

impl IntoChildren<Vec<NodeBlueprint>> for NodeBlueprint

Source§

impl IntoChildren<View> for NodeBlueprint

Source§

impl IntoNodeBlueprint for NodeBlueprint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoInitialState<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>