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 verify_scopes_integrity(&self)
pub fn provide_root_context<T: 'static + Clone>( &mut self, context: impl FnOnce() -> T, ) -> T
pub fn handle_event( &mut self, node_id: impl Into<NodeId>, event_name: EventName, event_type: EventType, bubbles: bool, ) -> bool
pub async fn handle_events(&mut self)
Sourcepub fn handle_events_immediately(&mut self)
pub fn handle_events_immediately(&mut self)
Useful for freya-testing
pub fn sync_and_update(&mut self) -> Mutations
pub fn run_in<T>(&self, run: impl FnOnce() -> T) -> T
pub fn mark_all_scopes_dirty(&mut self)
Sourcepub fn clear_all_scopes_storages(&mut self)
pub fn clear_all_scopes_storages(&mut self)
Resets all scope storages, clearing hook values back to their initial state.
Contexts are preserved so that imperatively-provided root contexts (e.g. crate::prelude::Platform) survive the reload.
Each reset runs inside CurrentContext::run so that drop handlers registered via crate::prelude::use_drop
(e.g. use_asset cleanup) can safely call crate::prelude::spawn_forever during value destruction.
Sourcepub fn clear_all_tasks(&mut self)
pub fn clear_all_tasks(&mut self)
Cancels all running tasks and drains any pending messages those tasks may have queued.
Must be called before Self::clear_all_scopes_storages during hot-reload so that stale
task wakers cannot keep firing Message::PollTask after the scope state is reset,
which would otherwise saturate the main thread with empty update cycles.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runner
impl !RefUnwindSafe for Runner
impl !Send for Runner
impl !Sync for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
impl !UnwindSafe 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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