pub struct InitContext {
pub target: TargetInfo,
/* private fields */
}Expand description
Context supplied to the ordinary root initializer on the UI owner thread. The application’s property graph is entered for the duration of the call. Construct the root promptly, then use scoped work for asynchronous loading.
Fields§
§target: TargetInfoImplementations§
Source§impl InitContext
impl InitContext
Sourcepub fn lifetime(&self) -> &AppContext
pub fn lifetime(&self) -> &AppContext
Cancellation and retained cleanup boundary for explicitly owned executors.
Sourcepub fn startup_data(&self) -> &[u8] ⓘ
pub fn startup_data(&self) -> &[u8] ⓘ
Read application-defined startup bytes. Decode and validate them in the initializer; the host never receives access to the resulting Rust values.
Sourcepub fn on_host_request(
&self,
handler: impl Fn(Vec<u8>) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>> + 'static,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn on_host_request( &self, handler: impl Fn(Vec<u8>) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>> + 'static, ) -> Result<(), Box<dyn Error + Send + Sync>>
Install the application’s one host request handler during initialization. Requests run on the UI owner through the scoped delivery queue after activation. Return promptly; start scoped async work for longer operations. Requests and replies are bounded byte buffers with an app-defined encoding. Closing cancels queued requests. The handler is released before cleanup.