pub struct AppHandle { /* private fields */ }Expand description
Handle to a running application.
Owns the root region and provides stop / join lifecycle operations.
§Drop semantics
Panics on drop if neither stop nor join has been called (leak-preventing
bomb, matching GradedObligation). Call AppHandle::into_raw to opt out
of this guarantee when you know what you’re doing.
Implementations§
Source§impl AppHandle
impl AppHandle
Sourcepub fn root_region(&self) -> RegionId
pub fn root_region(&self) -> RegionId
The root region owned by this application.
Sourcepub fn supervisor(&self) -> &SupervisorHandle
pub fn supervisor(&self) -> &SupervisorHandle
The supervisor handle for the app’s root supervisor.
Sourcepub fn registry(&self) -> Option<&RegistryHandle>
pub fn registry(&self) -> Option<&RegistryHandle>
The registry capability handle, if the app was started with one.
Sourcepub fn stop(self, state: &mut RuntimeState) -> Result<StoppedApp, AppStopError>
pub fn stop(self, state: &mut RuntimeState) -> Result<StoppedApp, AppStopError>
Request cancellation of the application root region.
This initiates the cancel-correct shutdown sequence: close → drain → finalize → quiescence.
After calling stop, the region will transition through its lifecycle
states. Use AppHandle::is_stopped or poll the region state to
determine when quiescence is reached.
Sourcepub fn is_stopped(&self, state: &RuntimeState) -> bool
pub fn is_stopped(&self, state: &RuntimeState) -> bool
Check whether the app’s root region has reached terminal (Closed) state.
Sourcepub fn is_quiescent(&self, state: &RuntimeState) -> bool
pub fn is_quiescent(&self, state: &RuntimeState) -> bool
Check whether the app’s root region is quiescent (no live tasks, no pending obligations, no finalizers).
Sourcepub fn join(self, state: &RuntimeState) -> Result<StoppedApp, AppStopError>
pub fn join(self, state: &RuntimeState) -> Result<StoppedApp, AppStopError>
Wait for the application’s root region to reach a terminal state.
Returns the terminal region state. In Phase 0 (synchronous runtime), this polls the region state; in async runtimes, this would await region completion.
Sourcepub fn into_raw(self) -> RawAppHandle
pub fn into_raw(self) -> RawAppHandle
Escape hatch: consume the handle without requiring stop/join.
Returns the raw region ID. The caller assumes responsibility for lifecycle management of the root region.