Struct FlexibleCompoundComponent

Source
pub struct FlexibleCompoundComponent { /* private fields */ }
Expand description

A flexible compound component implementation

Implementations§

Source§

impl FlexibleCompoundComponent

Source

pub fn new(context: Context) -> Self

Source

pub fn add_sub_component( &mut self, component: Box<dyn Component<Props = FlexibleCompoundProps>>, )

Trait Implementations§

Source§

impl Component for FlexibleCompoundComponent

Source§

type Props = FlexibleCompoundProps

The props type for this component
Source§

fn component_id(&self) -> ComponentId

Get unique component ID for debugging and tracking
Source§

fn create(_props: Self::Props, context: Context) -> Self

Create a new component instance with enhanced tracking
Source§

fn update(&mut self, props: Self::Props) -> Result<(), ComponentError>

Update component with new props
Source§

fn render(&self) -> Result<Vec<Node>, ComponentError>

Render component - returns child nodes
Source§

fn as_any(&self) -> &dyn Any

Convert to Any for downcasting
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Convert to mutable Any for downcasting
Source§

fn initialize(&mut self) -> Result<(), ComponentError>

Initialize the component - called immediately after creation Use this for setting up initial state and registering lifecycle hooks
Source§

fn mount(&mut self) -> Result<(), ComponentError>

Mount component - called when component is first added to the tree Automatic state change detection and update scheduling is enabled after this point
Source§

fn on_mount(&mut self, _context: &MountContext) -> Result<(), ComponentError>

Enhanced lifecycle hook - called when component is mounted with context
Source§

fn before_mount(&mut self) -> Result<(), ComponentError>

Enhanced lifecycle hook - called before mount for initialization
Source§

fn after_mount(&mut self) -> Result<(), ComponentError>

Enhanced lifecycle hook - called after mount for post-initialization
Source§

fn state_changed(&mut self, _state_key: &str) -> Result<(), ComponentError>

Called when component state changes and updates are needed
Source§

fn on_update(&mut self, _changes: &StateChanges) -> Result<(), ComponentError>

Enhanced lifecycle hook - called when state changes are detected
Source§

fn request_update(&mut self) -> Result<(), ComponentError>

Request that this component be re-rendered
Source§

fn should_update(&self, _new_props: &Self::Props) -> bool

Check if component should update given new props Override for performance optimization
Source§

fn before_update( &mut self, _new_props: &Self::Props, ) -> Result<(), ComponentError>

Called before component updates with new props
Source§

fn after_update(&mut self) -> Result<(), ComponentError>

Called after the component has updated
Source§

fn before_unmount(&mut self) -> Result<(), ComponentError>

Called before component is unmounted Automatic cleanup of state subscriptions happens after this
Source§

fn on_unmount( &mut self, _context: &UnmountContext, ) -> Result<(), ComponentError>

Enhanced lifecycle hook - called when component is unmounted with context
Source§

fn after_unmount(&mut self) -> Result<(), ComponentError>

Enhanced lifecycle hook - called after unmount for final cleanup
Source§

fn unmount(&mut self) -> Result<(), ComponentError>

Unmount component - called when component is removed from the tree
Source§

fn cleanup(&mut self) -> Result<(), ComponentError>

Perform automatic cleanup (called by framework)
Source§

fn lifecycle_phase(&self) -> LifecyclePhase

Get current lifecycle phase
Source§

impl CompoundComponent for FlexibleCompoundComponent

Source§

type SubComponents = Vec<Box<dyn Component<Props = FlexibleCompoundProps>>>

Source§

fn sub_components(&self) -> &Self::SubComponents

Get the sub-components of this compound component
Source§

fn sub_components_mut(&mut self) -> &mut Self::SubComponents

Get a mutable reference to sub-components
Source§

fn render_compound(&self) -> Result<Vec<Node>, ComponentError>

Render all sub-components in order

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> AnyComponent for T
where T: Component,

Source§

fn component_id(&self) -> ComponentId

Get unique component ID for debugging and tracking
Source§

fn lifecycle_phase(&self) -> LifecyclePhase

Get current lifecycle phase
Source§

fn set_lifecycle_phase(&mut self, _phase: LifecyclePhase)

Set lifecycle phase (framework internal)
Source§

fn request_update(&mut self) -> Result<(), ComponentError>

Request that this component be re-rendered
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to Any for downcasting
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to mutable Any for downcasting
Source§

fn type_name(&self) -> &'static str

Get component type name for debugging
Source§

fn any_initialize(&mut self) -> Result<(), ComponentError>

Initialize the component (post-creation)
Source§

fn any_mount(&mut self) -> Result<(), ComponentError>

Mount component - called when component is first added to the tree
Source§

fn any_before_update( &mut self, props: Box<dyn Props>, ) -> Result<(), ComponentError>

Called before component updates with new props
Source§

fn any_update(&mut self, props: Box<dyn Props>) -> Result<(), ComponentError>

Update component with new props (type-erased)
Source§

fn any_after_update(&mut self) -> Result<(), ComponentError>

Called after the component has updated
Source§

fn any_before_unmount(&mut self) -> Result<(), ComponentError>

Called before component is unmounted
Source§

fn any_unmount(&mut self) -> Result<(), ComponentError>

Unmount component - called when component is removed from the tree
Source§

fn any_on_mount(&mut self, context: &MountContext) -> Result<(), ComponentError>

Enhanced mount with context
Source§

fn any_before_mount(&mut self) -> Result<(), ComponentError>

Before mount hook
Source§

fn any_after_mount(&mut self) -> Result<(), ComponentError>

After mount hook
Source§

fn any_on_update( &mut self, changes: &StateChanges, ) -> Result<(), ComponentError>

Enhanced update with state changes
Source§

fn any_on_unmount( &mut self, context: &UnmountContext, ) -> Result<(), ComponentError>

Enhanced unmount with context
Source§

fn any_after_unmount(&mut self) -> Result<(), ComponentError>

After unmount hook
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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.