pub struct ComponentBase { /* private fields */ }
Expand description
Base component functionality that all components share
Implementations§
Source§impl ComponentBase
impl ComponentBase
Sourcepub fn new_with_layout(context: Context, layout_style: LayoutStyle) -> Self
pub fn new_with_layout(context: Context, layout_style: LayoutStyle) -> Self
Create a new component base with custom layout style
Sourcepub fn id(&self) -> ComponentId
pub fn id(&self) -> ComponentId
Get the component ID
Sourcepub fn lifecycle_phase(&self) -> LifecyclePhase
pub fn lifecycle_phase(&self) -> LifecyclePhase
Get the current lifecycle phase
Sourcepub fn set_lifecycle_phase(&mut self, phase: LifecyclePhase)
pub fn set_lifecycle_phase(&mut self, phase: LifecyclePhase)
Set the lifecycle phase (framework internal)
Sourcepub fn layout_style(&self) -> &LayoutStyle
pub fn layout_style(&self) -> &LayoutStyle
Get reference to the layout style
Sourcepub fn layout_style_mut(&mut self) -> &mut LayoutStyle
pub fn layout_style_mut(&mut self) -> &mut LayoutStyle
Get mutable reference to the layout style
Sourcepub fn set_layout_style(&mut self, layout_style: LayoutStyle)
pub fn set_layout_style(&mut self, layout_style: LayoutStyle)
Set the layout style
Sourcepub fn create_layout_node(&self) -> LayoutNode
pub fn create_layout_node(&self) -> LayoutNode
Create a layout node for this component
Sourcepub fn context_mut(&mut self) -> &mut Context
pub fn context_mut(&mut self) -> &mut Context
Get mutable reference to the context
Trait Implementations§
Source§impl Component for ComponentBase
Basic Component implementation for ComponentBase (primarily for testing)
impl Component for ComponentBase
Basic Component implementation for ComponentBase (primarily for testing)
Source§fn component_id(&self) -> ComponentId
fn component_id(&self) -> ComponentId
Get unique component ID for debugging and tracking
Source§fn create(_props: Self::Props, context: Context) -> Self
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>
fn update(&mut self, _props: Self::Props) -> Result<(), ComponentError>
Update component with new props
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Convert to mutable Any for downcasting
Source§fn lifecycle_phase(&self) -> LifecyclePhase
fn lifecycle_phase(&self) -> LifecyclePhase
Get current lifecycle phase
Source§fn initialize(&mut self) -> Result<(), ComponentError>
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>
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>
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>
fn before_mount(&mut self) -> Result<(), ComponentError>
Enhanced lifecycle hook - called before mount for initialization
Source§fn after_mount(&mut self) -> Result<(), ComponentError>
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>
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>
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>
fn request_update(&mut self) -> Result<(), ComponentError>
Request that this component be re-rendered
Source§fn should_update(&self, _new_props: &Self::Props) -> bool
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>
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>
fn after_update(&mut self) -> Result<(), ComponentError>
Called after the component has updated
Source§fn before_unmount(&mut self) -> Result<(), ComponentError>
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>
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>
fn after_unmount(&mut self) -> Result<(), ComponentError>
Enhanced lifecycle hook - called after unmount for final cleanup
Auto Trait Implementations§
impl Freeze for ComponentBase
impl RefUnwindSafe for ComponentBase
impl Send for ComponentBase
impl Sync for ComponentBase
impl Unpin for ComponentBase
impl UnwindSafe for ComponentBase
Blanket Implementations§
Source§impl<T> AnyComponent for Twhere
T: Component,
impl<T> AnyComponent for Twhere
T: Component,
Source§fn component_id(&self) -> ComponentId
fn component_id(&self) -> ComponentId
Get unique component ID for debugging and tracking
Source§fn lifecycle_phase(&self) -> LifecyclePhase
fn lifecycle_phase(&self) -> LifecyclePhase
Get current lifecycle phase
Source§fn set_lifecycle_phase(&mut self, _phase: LifecyclePhase)
fn set_lifecycle_phase(&mut self, _phase: LifecyclePhase)
Set lifecycle phase (framework internal)
Source§fn request_update(&mut self) -> Result<(), ComponentError>
fn request_update(&mut self) -> Result<(), ComponentError>
Request that this component be re-rendered
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert to mutable Any for downcasting
Source§fn any_initialize(&mut self) -> Result<(), ComponentError>
fn any_initialize(&mut self) -> Result<(), ComponentError>
Initialize the component (post-creation)
Source§fn any_mount(&mut self) -> Result<(), ComponentError>
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>
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>
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>
fn any_after_update(&mut self) -> Result<(), ComponentError>
Called after the component has updated
Source§fn any_before_unmount(&mut self) -> Result<(), ComponentError>
fn any_before_unmount(&mut self) -> Result<(), ComponentError>
Called before component is unmounted
Source§fn any_unmount(&mut self) -> Result<(), ComponentError>
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>
fn any_on_mount(&mut self, context: &MountContext) -> Result<(), ComponentError>
Enhanced mount with context
Source§fn any_before_mount(&mut self) -> Result<(), ComponentError>
fn any_before_mount(&mut self) -> Result<(), ComponentError>
Before mount hook
Source§fn any_after_mount(&mut self) -> Result<(), ComponentError>
fn any_after_mount(&mut self) -> Result<(), ComponentError>
After mount hook
Source§fn any_on_update(
&mut self,
changes: &StateChanges,
) -> Result<(), ComponentError>
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>
fn any_on_unmount( &mut self, context: &UnmountContext, ) -> Result<(), ComponentError>
Enhanced unmount with context
Source§fn any_after_unmount(&mut self) -> Result<(), ComponentError>
fn any_after_unmount(&mut self) -> Result<(), ComponentError>
After unmount hook
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
Mutably borrows from an owned value. Read more