pub struct RenderContext {
pub fiber_tree: FiberTree,
pub state_batch: StateBatch,
pub effect_queue: EffectQueue,
pub context_stack: ContextStack,
pub event_state: EventState,
}Expand description
Consolidated render context containing all render-related state.
This struct combines all the previously separate thread-local state into a single location for easier management and better encapsulation.
Fields§
§fiber_tree: FiberTreeFiber tree tracking all mounted component instances
state_batch: StateBatchState batch for grouping multiple state updates
effect_queue: EffectQueueEffect queue for post-commit effect execution
context_stack: ContextStackContext stack for React-like context system
event_state: EventStateCurrent event state for terminal event handling
Implementations§
Source§impl RenderContext
impl RenderContext
Sourcepub fn prepare_for_render(&mut self)
pub fn prepare_for_render(&mut self)
Reset all state for a new render pass
This prepares the context for a new frame by:
- Resetting hook indices in the fiber tree
- Clearing the current event
Sourcepub fn set_event(&mut self, event: Option<Arc<Event>>)
pub fn set_event(&mut self, event: Option<Arc<Event>>)
Set the current event for this render pass
Sourcepub fn clear_event(&mut self)
pub fn clear_event(&mut self)
Clear the current event
Sourcepub fn begin_batch(&mut self)
pub fn begin_batch(&mut self)
Begin state batching
Sourcepub fn end_batch(&mut self) -> HashSet<FiberId>
pub fn end_batch(&mut self) -> HashSet<FiberId>
End state batching and apply updates
Returns the set of fiber IDs that were modified
Sourcepub fn flush_effects(&mut self)
pub fn flush_effects(&mut self)
Flush synchronous effects
Sourcepub async fn flush_async_effects(&mut self)
pub async fn flush_async_effects(&mut self)
Flush async effects
Sourcepub fn mark_unseen_for_unmount(&mut self)
pub fn mark_unseen_for_unmount(&mut self)
Mark unseen fibers for unmount
Sourcepub fn process_unmounts(&mut self) -> Vec<FiberId>
pub fn process_unmounts(&mut self) -> Vec<FiberId>
Process pending unmounts
This cleans up context values and removes fibers that were scheduled for unmount.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RenderContext
impl !RefUnwindSafe for RenderContext
impl !Send for RenderContext
impl !Sync for RenderContext
impl Unpin for RenderContext
impl !UnwindSafe for RenderContext
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> 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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more