pub struct Context { /* private fields */ }
Expand description
Context passed to components providing access to state, events, and shared context
Implementations§
Source§impl Context
impl Context
Sourcepub fn id(&self) -> ComponentId
pub fn id(&self) -> ComponentId
Get the context ID
Sourcepub fn state(&self) -> &StateContainer
pub fn state(&self) -> &StateContainer
Get access to the state container
Sourcepub fn events(&self) -> &EventEmitter
pub fn events(&self) -> &EventEmitter
Get access to the event emitter
Sourcepub fn lifecycle_phase(&self) -> LifecyclePhase
pub fn lifecycle_phase(&self) -> LifecyclePhase
Get the current lifecycle phase
Sourcepub fn schedule_update(&self, component_id: ComponentId)
pub fn schedule_update(&self, component_id: ComponentId)
Schedule a component update
Sourcepub fn has_pending_update(&self, component_id: ComponentId) -> bool
pub fn has_pending_update(&self, component_id: ComponentId) -> bool
Check if component has pending updates
Sourcepub fn create_reactive_state<T>(
&self,
initial_value: T,
component_id: ComponentId,
) -> State<T>
pub fn create_reactive_state<T>( &self, initial_value: T, component_id: ComponentId, ) -> State<T>
Create a reactive state that triggers component updates
Sourcepub fn register_lifecycle_hooks<F>(&self, setup: F)where
F: FnOnce(&mut LifecycleHooks),
pub fn register_lifecycle_hooks<F>(&self, setup: F)where
F: FnOnce(&mut LifecycleHooks),
Register lifecycle hooks
Sourcepub fn execute_lifecycle_hooks(
&self,
phase: LifecyclePhase,
component: &mut dyn AnyComponent,
)
pub fn execute_lifecycle_hooks( &self, phase: LifecyclePhase, component: &mut dyn AnyComponent, )
Execute lifecycle hooks for a specific phase
Sourcepub fn context_provider(&self) -> &ContextProvider
pub fn context_provider(&self) -> &ContextProvider
Get context provider for parent-child communication
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Event for T
impl<T> Event for T
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert to Any for downcasting (mutable)
Source§fn event_type(&self) -> &'static str
fn event_type(&self) -> &'static str
Get the event type name
Source§impl<T> Props for T
impl<T> Props for T
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