pub struct Runner {
pub scopes: FxHashMap<ScopeId, Rc<RefCell<Scope>>>,
pub scopes_storages: Rc<RefCell<FxHashMap<ScopeId, ScopeStorage>>>,
pub node_to_scope: FxHashMap<NodeId, ScopeId>,
/* private fields */
}Fields§
§scopes: FxHashMap<ScopeId, Rc<RefCell<Scope>>>§scopes_storages: Rc<RefCell<FxHashMap<ScopeId, ScopeStorage>>>§node_to_scope: FxHashMap<NodeId, ScopeId>Implementations§
Source§impl Runner
impl Runner
pub fn new(root: impl Fn() -> Element + 'static) -> Self
pub fn with_root_context<T>(&self, run: impl FnOnce() -> T) -> T
pub fn provide_root_context<T: 'static + Clone>( &mut self, context: impl FnOnce() -> T, ) -> T
Sourcepub fn handle_event(
&mut self,
node_id: impl Into<NodeId>,
event_name: EventName,
event_type: EventType,
bubbles: bool,
) -> bool
pub fn handle_event( &mut self, node_id: impl Into<NodeId>, event_name: EventName, event_type: EventType, bubbles: bool, ) -> bool
Dispatches an event, returning whether its default action remains enabled. Missing nodes are ignored without cancelling other queued events.
pub async fn handle_events(&mut self)
Sourcepub async fn handle_events_with(
&mut self,
observer: &mut dyn FnMut(TasksPollStage),
)
pub async fn handle_events_with( &mut self, observer: &mut dyn FnMut(TasksPollStage), )
Like Self::handle_events, notifying the observer around every tasks polling batch.
Sourcepub fn handle_events_immediately(&mut self)
pub fn handle_events_immediately(&mut self)
Like Self::handle_events, but returns instead of waiting for more work.
Sourcepub fn handle_events_immediately_with(
&mut self,
observer: &mut dyn FnMut(TasksPollStage),
)
pub fn handle_events_immediately_with( &mut self, observer: &mut dyn FnMut(TasksPollStage), )
Like Self::handle_events_immediately, notifying the observer around every tasks polling batch.
Tasks are polled even when there are dirty scopes, otherwise a constant flow of events would starve them.
pub fn sync_and_update(&mut self) -> Mutations
pub fn run_in<T>(&self, run: impl FnOnce() -> T) -> T
Sourcepub fn reload(&mut self)
pub fn reload(&mut self)
Reloads the runner for a hot-reload: cancels tasks, reloads every scope’s hooks
(contexts are preserved), and marks every scope dirty. Task cancellation must
happen first so stale wakers can’t fire Message::PollTask against
freshly-reloaded scopes.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Runner
impl !Send for Runner
impl !Sync for Runner
impl !UnwindSafe for Runner
impl Forget for Runner
impl Freeze for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
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> 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> ⓘ
Converts
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> ⓘ
Converts
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