Struct fuchsia_component_test::RealmInstance
source · pub struct RealmInstance {
pub root: ScopedInstance,
/* private fields */
}
Expand description
A running instance of a created realm. When this struct is dropped the realm is destroyed, along with any components that were in the realm.
Fields§
§root: ScopedInstance
The root component of this realm instance, which can be used to access exposed capabilities from the realm.
Implementations§
source§impl RealmInstance
impl RealmInstance
sourcepub async fn destroy(self) -> Result<(), Error>
pub async fn destroy(self) -> Result<(), Error>
Destroys the realm instance, returning only once realm destruction is complete.
This function can be useful to call when it’s important to ensure a realm accessing a global resource is stopped before proceeding, or to ensure that realm destruction doesn’t race with process (and thus local component implementations) termination.
sourcepub async fn start_component_tree(&self) -> Result<(), Error>
pub async fn start_component_tree(&self) -> Result<(), Error>
Connects to the fuchsia.sys2.LifecycleController
protocol exposed by a nested
component manager and attempts to start the root component. This should only be used
when a realm is built in a nested component manager in debug mode.
Trait Implementations§
source§impl Drop for RealmInstance
impl Drop for RealmInstance
source§fn drop(&mut self)
fn drop(&mut self)
To ensure local components are shutdown in an orderly manner (i.e. after their dependent
clients) upon drop
, keep the local_component_runner_task alive in an async task until the
destroy_waiter synchronously destroys the realm.
Remember that you must keep a life reference to a RealmInstance
to ensure that your
realm stays running.