pub struct ExpandedNode {Show 24 fields
pub id: ExpandedNodeIdentifier,
pub instance_node: RefCell<InstanceNodePtr>,
pub render_parent: RefCell<Weak<ExpandedNode>>,
pub template_parent: Weak<ExpandedNode>,
pub parent_frame: Property<Option<ExpandedNodeIdentifier>>,
pub containing_component: Weak<ExpandedNode>,
pub stack: Rc<RuntimePropertiesStackFrame>,
pub children: Property<Vec<Rc<ExpandedNode>>>,
pub mounted_children: RefCell<Vec<Rc<ExpandedNode>>>,
pub properties: RefCell<Rc<RefCell<PaxAny>>>,
pub common_properties: RefCell<Rc<RefCell<CommonProperties>>>,
pub rendered_size: Property<Option<(f64, f64)>>,
pub transform_and_bounds: Property<TransformAndBounds<NodeLocal, Window>>,
pub expanded_slot_children: RefCell<Option<Vec<Rc<ExpandedNode>>>>,
pub expanded_and_flattened_slot_children: Property<Vec<Rc<ExpandedNode>>>,
pub flattened_slot_children_count: Property<usize>,
pub attached: Cell<u32>,
pub occlusion: Property<Occlusion>,
pub properties_scope: RefCell<HashMap<String, Variable>>,
pub slot_index: Property<Option<usize>>,
pub suspended: Property<bool>,
pub native_message_listener: Property<()>,
pub slot_child_attached_listener: Property<()>,
pub subscriptions: RefCell<Vec<Property<()>>>,
}Fields§
§id: ExpandedNodeIdentifierUnique ID of this expanded node, roughly encoding an address in the tree, where the first u32 is the instance ID and the subsequent u32s represent addresses within an expanded tree via Repeat.
instance_node: RefCell<InstanceNodePtr>Pointer to the unexpanded instance_node underlying this ExpandedNode
render_parent: RefCell<Weak<ExpandedNode>>Pointer (Weak to avoid Rc cycle memory leaks) to the ExpandedNode
rendered directly above this one.
template_parent: Weak<ExpandedNode>Pointer (Weak to avoid Rc cycle memory leaks) to the ExpandedNode
in the template directly above this one.
parent_frame: Property<Option<ExpandedNodeIdentifier>>Id of closest frame present in the node tree. included as a parameter on AnyCreatePatch when creating a native element to know what clipping context to attach to
containing_component: Weak<ExpandedNode>Reference to the component for which this ExpandedNode is a template member. Used at least for
getting a reference to slot_children for slot. Optional because the very root instance node (root component, root instance node)
has a corollary “root component expanded node.” That very root expanded node does not have a containing ExpandedNode component,
thus containing_component is Optional.
stack: Rc<RuntimePropertiesStackFrame>Persistent clone of the state of the [PropertiesTreeShared#runtime_properties_stack] at the time that this node was expanded (this is expected to remain immutable
through the lifetime of the program after the initial expansion; however, if that constraint changes, this should be
explicitly updated to accommodate.)
children: Property<Vec<Rc<ExpandedNode>>>Pointers to the ExpandedNode beneath this one. Used for e.g. rendering recursion.
mounted_children: RefCell<Vec<Rc<ExpandedNode>>>A list of mounted children that need to be dismounted when children is recalculated
properties: RefCell<Rc<RefCell<PaxAny>>>Each ExpandedNode has a unique “stamp” of computed properties
common_properties: RefCell<Rc<RefCell<CommonProperties>>>Each ExpandedNode has unique, computed CommonProperties
rendered_size: Property<Option<(f64, f64)>>Set by chassis, for for example text nodes that get resize info from an interrupt if a node doesn’t have fixed bounds(width/height specified), this value is used instead.
transform_and_bounds: Property<TransformAndBounds<NodeLocal, Window>>The layout information (width, height, transform) used to render this node. computed property based on parent bounds + common properties
expanded_slot_children: RefCell<Option<Vec<Rc<ExpandedNode>>>>For component instances only, tracks the expanded slot_children in its non-collapsed form (repeat and conditionals still present). This allows repeat/conditionals to update their children (handled in component.rs update_children method)
expanded_and_flattened_slot_children: Property<Vec<Rc<ExpandedNode>>>Flattened version of the above, where repeat/conditionals are removed recursively and replaced by their children. This is re-computed each frame from the non-collapsed expanded_slot_children after they have been updated.
flattened_slot_children_count: Property<usize>§attached: Cell<u32>Flag that is > 0 if this node is part of the root tree. If it is, updates to this nodes children also marks them as attached (+1), triggering mount and dismount on addition/removal. This is needed mainly for slot, since an entire “shadow tree” needs to be expanded and updated for each slot child, but only the ones that have a “connected” slot should trigger mount/dismount updates
occlusion: Property<Occlusion>Occlusion layer for this node. Used by canvas elements to decide what canvas to draw on, and by native elements to move to the correct native layer.
properties_scope: RefCell<HashMap<String, Variable>>A map of all properties available on this expanded node. Used by the RuntimePropertiesStackFrame to resolve symbols.
slot_index: Property<Option<usize>>The flattened index of this node in its container (if this container cares about slot children, ex: component, path).
suspended: Property<bool>property used to “freeze” (stop firing tick) on a node and all it’s children
native_message_listener: Property<()>used by native elements to trigger sending of native messages
slot_child_attached_listener: Property<()>used to know when a slot child is attached
subscriptions: RefCell<Vec<Property<()>>>subscription properties: added to this expanded node by calling ctx.subscribe in a node event handler
Implementations§
Source§impl ExpandedNode
impl ExpandedNode
pub fn initialize_root( template: Rc<ComponentInstance>, ctx: &Rc<RuntimeContext>, ) -> Rc<Self>
pub fn recreate_with_new_data( self: &Rc<Self>, template: Rc<dyn InstanceNode>, context: &Rc<RuntimeContext>, )
pub fn fully_recreate_with_new_data( self: &Rc<Self>, template: Rc<dyn InstanceNode>, context: &Rc<RuntimeContext>, )
Sourcepub fn is_descendant_of(
&self,
other_expanded_node_id: &ExpandedNodeIdentifier,
) -> bool
pub fn is_descendant_of( &self, other_expanded_node_id: &ExpandedNodeIdentifier, ) -> bool
Returns whether this node is a descendant of the ExpandedNode described by other_expanded_node_id (id)
Currently requires traversing linked list of ancestry, incurring a O(log(n)) cost for a tree of n elements.
This could be mitigated with caching/memoization, perhaps by storing a HashSet on each ExpandedNode describing its ancestry chain.
pub fn create_children_detached( self: &Rc<Self>, templates: impl IntoIterator<Item = (Rc<dyn InstanceNode>, Rc<RuntimePropertiesStackFrame>)>, context: &Rc<RuntimeContext>, template_parent: &Weak<ExpandedNode>, ) -> Vec<Rc<ExpandedNode>>
pub fn attach_children( self: &Rc<Self>, new_children: Vec<Rc<ExpandedNode>>, context: &Rc<RuntimeContext>, parent_frame: &Property<Option<ExpandedNodeIdentifier>>, ) -> Vec<Rc<ExpandedNode>>
pub fn inherit_suspend(self: &Rc<Self>, node: &Rc<Self>)
pub fn generate_children( self: &Rc<Self>, templates: impl IntoIterator<Item = (Rc<dyn InstanceNode>, Rc<RuntimePropertiesStackFrame>)>, context: &Rc<RuntimeContext>, parent_frame: &Property<Option<ExpandedNodeIdentifier>>, is_mount: bool, ) -> Vec<Rc<ExpandedNode>>
Sourcepub fn recurse_update(self: &Rc<Self>, context: &Rc<RuntimeContext>)
pub fn recurse_update(self: &Rc<Self>, context: &Rc<RuntimeContext>)
This method recursively updates all node properties. When dirty-dag exists, this won’t need to be here since all property dependencies can be set up and removed during mount/unmount
pub fn recurse_control_flow_expansion( self: &Rc<Self>, context: &Rc<RuntimeContext>, )
pub fn recurse_mount(self: &Rc<Self>, context: &Rc<RuntimeContext>)
pub fn recurse_unmount(self: Rc<Self>, context: &Rc<RuntimeContext>)
pub fn recurse_render_queue( self: &Rc<Self>, ctx: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )
pub fn recurse_render( self: &Rc<Self>, ctx: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )
Sourcepub fn with_properties_unwrapped<T: ToFromPaxAny, R>(
&self,
callback: impl FnOnce(&mut T) -> R,
) -> R
pub fn with_properties_unwrapped<T: ToFromPaxAny, R>( &self, callback: impl FnOnce(&mut T) -> R, ) -> R
Manages unpacking an Rc<RefCelltarget_type, and executing a provided closure body in the
context of that unwrapped variant (including support for mutable operations),
the closure is executed. Used at least by calculating properties in expand_node and
passing &mut self into event handlers (where the typed self is retrieved from an instance of PaxValue)
pub fn try_with_properties_unwrapped<T: ToFromPaxAny, R>( &self, callback: impl FnOnce(&mut T) -> R, ) -> Option<R>
pub fn recurse_visit_postorder( self: &Rc<Self>, func: &mut impl FnMut(&Rc<Self>), )
pub fn get_node_context( self: &Rc<Self>, ctx: &Rc<RuntimeContext>, ) -> NodeContext
pub fn get_common_properties(&self) -> Rc<RefCell<CommonProperties>>
Sourcepub fn ray_cast_test(&self, ray: Point2<Window>) -> bool
pub fn ray_cast_test(&self, ray: Point2<Window>) -> bool
Determines whether the provided ray, orthogonal to the view plane,
intersects this ExpandedNode.
pub fn compute_flattened_slot_children(&self)
pub fn dispatch_scroll( self: &Rc<Self>, event: Event<Scroll>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_clap( self: &Rc<Self>, event: Event<Clap>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_touch_start( self: &Rc<Self>, event: Event<TouchStart>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_touch_move( self: &Rc<Self>, event: Event<TouchMove>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_touch_end( self: &Rc<Self>, event: Event<TouchEnd>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_key_down( self: &Rc<Self>, event: Event<KeyDown>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_key_up( self: &Rc<Self>, event: Event<KeyUp>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_key_press( self: &Rc<Self>, event: Event<KeyPress>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_checkbox_change( self: &Rc<Self>, event: Event<CheckboxChange>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_textbox_change( self: &Rc<Self>, event: Event<TextboxChange>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_text_input( self: &Rc<Self>, event: Event<TextInput>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_textbox_input( self: &Rc<Self>, event: Event<TextboxInput>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_mouse_down( self: &Rc<Self>, event: Event<MouseDown>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_mouse_up( self: &Rc<Self>, event: Event<MouseUp>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_mouse_move( self: &Rc<Self>, event: Event<MouseMove>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_mouse_over( self: &Rc<Self>, event: Event<MouseOver>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_mouse_out( self: &Rc<Self>, event: Event<MouseOut>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_double_click( self: &Rc<Self>, event: Event<DoubleClick>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_click( self: &Rc<Self>, event: Event<Click>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_wheel( self: &Rc<Self>, event: Event<Wheel>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_drop( self: &Rc<Self>, event: Event<Drop>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_focus( self: &Rc<Self>, event: Event<Focus>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_select_start( self: &Rc<Self>, event: Event<SelectStart>, globals: &Globals, ctx: &Rc<RuntimeContext>, ) -> bool
pub fn dispatch_custom_event( self: &Rc<Self>, identifier: &str, ctx: &Rc<RuntimeContext>, ) -> Result<(), String>
pub fn chassis_resize_request(self: &Rc<ExpandedNode>, width: f64, height: f64)
Sourcepub fn layout_properties(self: &Rc<ExpandedNode>) -> Property<LayoutProperties>
pub fn layout_properties(self: &Rc<ExpandedNode>) -> Property<LayoutProperties>
Helper method that returns a collection of common properties related to layout (position, size, scale, anchor, etc),
Trait Implementations§
Source§impl Clone for ExpandedNode
impl Clone for ExpandedNode
Source§fn clone(&self) -> ExpandedNode
fn clone(&self) -> ExpandedNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExpandedNode
impl Debug for ExpandedNode
Source§impl Interpolatable for ExpandedNode
impl Interpolatable for ExpandedNode
fn interpolate(&self, _other: &Self, _t: f64) -> Self
impl ImplToFromPaxAny for ExpandedNode
Auto Trait Implementations§
impl !Freeze for ExpandedNode
impl !RefUnwindSafe for ExpandedNode
impl !Send for ExpandedNode
impl !Sync for ExpandedNode
impl Unpin for ExpandedNode
impl !UnwindSafe for ExpandedNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more