pub struct EnhancedContext { /* private fields */ }
Expand description
Context passed to components providing access to state and events
Implementations§
Source§impl Context
impl Context
Sourcepub fn for_component(component_id: ComponentId) -> Self
pub fn for_component(component_id: ComponentId) -> Self
Create a context for a specific component
Sourcepub fn state(&self) -> &StateContainer
pub fn state(&self) -> &StateContainer
Get a reference to the state container
Sourcepub fn state_mut(&mut self) -> &mut StateContainer
pub fn state_mut(&mut self) -> &mut StateContainer
Get a mutable reference to the state container
Sourcepub fn reactive_scope(&self) -> &Arc<ReactiveScope>
pub fn reactive_scope(&self) -> &Arc<ReactiveScope>
Get a reference to the reactive scope
Sourcepub fn events(&self) -> &EventEmitter
pub fn events(&self) -> &EventEmitter
Get a reference to the event emitter
Sourcepub fn events_mut(&mut self) -> &mut EventEmitter
pub fn events_mut(&mut self) -> &mut EventEmitter
Get a mutable reference to the event emitter
Sourcepub fn update_scheduler(&self) -> &UpdateScheduler
pub fn update_scheduler(&self) -> &UpdateScheduler
Get the update scheduler
Sourcepub fn lifecycle_phase(&self) -> LifecyclePhase
pub fn lifecycle_phase(&self) -> LifecyclePhase
Get current lifecycle phase
Sourcepub fn set_lifecycle_phase(&self, phase: LifecyclePhase)
pub fn set_lifecycle_phase(&self, phase: LifecyclePhase)
Set current lifecycle phase
Sourcepub fn register_lifecycle_hook<F>(&self, phase: LifecyclePhase, hook: F)
pub fn register_lifecycle_hook<F>(&self, phase: LifecyclePhase, hook: F)
Register a hook to be called at a specific lifecycle phase
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 all hooks for the current lifecycle phase
Sourcepub fn request_update(&self, component_id: ComponentId) -> Result<(), String>
pub fn request_update(&self, component_id: ComponentId) -> Result<(), String>
Request a component update with normal priority
Sourcepub fn request_critical_update(
&self,
component_id: ComponentId,
) -> Result<(), String>
pub fn request_critical_update( &self, component_id: ComponentId, ) -> Result<(), String>
Request a critical update (executed immediately if possible)
Sourcepub fn process_updates<F>(&self, update_fn: F) -> Result<usize, String>
pub fn process_updates<F>(&self, update_fn: F) -> Result<usize, String>
Process all pending updates
Sourcepub fn component_id(&self) -> Option<ComponentId>
pub fn component_id(&self) -> Option<ComponentId>
Get current component ID if set
Sourcepub fn set_component_id(&mut self, id: ComponentId)
pub fn set_component_id(&mut self, id: ComponentId)
Set the component ID for this context
Sourcepub fn create_child_context(&self, child_id: ComponentId) -> Self
pub fn create_child_context(&self, child_id: ComponentId) -> Self
Create a child context with this context as parent
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