pub struct Runtime { /* private fields */ }Expand description
Owns one graph and its scheduler. Runtime is intentionally not Clone.
Implementations§
Source§impl Runtime
impl Runtime
pub fn new() -> Self
pub fn with_host(host: Rc<dyn Host>) -> Self
pub fn id(&self) -> RuntimeId
pub fn profile(&self) -> Option<Profile>
pub fn set_profile(&self, profile: Option<Profile>)
pub fn now(&self) -> Option<Duration>
Sourcepub fn request_observe(&self) -> bool
pub fn request_observe(&self) -> bool
Ask the attached event loop for an observation turn. This does not poll tasks or execute application callbacks; host wake must only enqueue.
pub fn owner(&self) -> Owner
pub fn scope(&self) -> Scope
Sourcepub fn enter<R>(
&self,
instance: InstanceId,
f: impl FnOnce() -> R,
) -> Result<R, AccessError>
pub fn enter<R>( &self, instance: InstanceId, f: impl FnOnce() -> R, ) -> Result<R, AccessError>
Run a synchronous callback under a live instance’s Owner. This does not retain the instance, borrow the graph during the callback, or flush work. Foreign/stale identities are rejected before calling user code; nested context is restored on return or panic. Future polls need their own entry.
Sourcepub fn batch<R>(&self, f: impl FnOnce() -> R) -> Result<R, AccessError>
pub fn batch<R>(&self, f: impl FnOnce() -> R) -> Result<R, AccessError>
Values enqueue work. Explicit flush/batch at an event/frame boundary prevents a series of writes from rendering intermediate states.
pub fn flush(&self) -> Result<(), AccessError>
Sourcepub fn graph_stats(&self) -> GraphStats
pub fn graph_stats(&self) -> GraphStats
Explicit O(live nodes) diagnostic. Fixed aggregate bins contain no values, identities, visited rows or evaluation history.