async fn create_isolated_environment(
    label: &str,
) -> Result<(EnvironmentControllerProxy, LauncherProxy), Error> {
    let env = connect_to_service::<EnvironmentMarker>()
        .context("could not connect to current environment")?;

    let (new_env, new_env_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;
    let (controller, controller_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;
    let (launcher, launcher_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;

    // Component manager will run with these environment options
    let mut env_options = EnvironmentOptions {
        // This flag ensures that component manager gets all its required
        // services from the parent component
        inherit_parent_services: true,
        use_parent_runners: true,
        kill_on_oom: false,
        delete_storage_on_death: true,
    };

    env.create_nested_environment(
        new_env_server_end,
        controller_server_end,
        label,
        None,
        &mut env_options,
    )
    .context("could not create isolated environment")?;

    // Wait for the environment to be setup.
    // There is only one type of event (OnCreated) in this protocol, so just get the next one.
    let EnvironmentControllerEvent::OnCreated {} =
        controller.take_event_stream().next().await.unwrap().unwrap();

    // Get the launcher for this environment so it can be used to start component manager.
    new_env
        .get_launcher(launcher_server_end)
        .context("could not get isolated environment launcher")?;

    Ok((controller, launcher))
}
/// Creates an isolated environment for component manager inside this component.
/// This isolated environment will be given the provided label so as to identify
/// it uniquely in the hub.
Creates an isolated environment for component manager inside this component.
This isolated environment will be given the provided label so as to identify
it uniquely in the hub.
Creates an isolated environment for component manager inside this component . This isolated environment will be given the provided label so as to identify it uniquely in the hub .
async fn create_isolated_environment(
    label: &str,
) -> Result<(EnvironmentControllerProxy, LauncherProxy), Error> {
    let env = connect_to_service::<EnvironmentMarker>()
        .context("could not connect to current environment")?;
    let (new_env, new_env_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;
    let (controller, controller_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;
    let (launcher, launcher_server_end) =
        fidl::endpoints::create_proxy().context("could not create proxy")?;
    // Component manager will run with these environment options
    let mut env_options = EnvironmentOptions {
        // This flag ensures that component manager gets all its required
        // services from the parent component
        inherit_parent_services: true,
        use_parent_runners: true,
        kill_on_oom: false,
        delete_storage_on_death: true,
    };
    env.create_nested_environment(
        new_env_server_end,
        controller_server_end,
        label,
        None,
        &mut env_options,
    )
    .context("could not create isolated environment")?;
    // Wait for the environment to be setup.
    // There is only one type of event (OnCreated) in this protocol, so just get the next one.
    let EnvironmentControllerEvent::OnCreated {} =
        controller.take_event_stream().next().await.unwrap().unwrap();
    // Get the launcher for this environment so it can be used to start component manager.
    new_env
        .get_launcher(launcher_server_end)
        .context("could not get isolated environment launcher")?;
    Ok((controller, launcher))
}
async fn create_isolated_environment ( label : & str , ) -> Result < ( EnvironmentControllerProxy , LauncherProxy ) , Error > { let env = connect_to_service :: < EnvironmentMarker > ( ) . context ( " " ) ? ; let ( new_env , new_env_server_end ) = fidl :: endpoints :: create_proxy ( ) . context ( " " ) ? ; let ( controller , controller_server_end ) = fidl :: endpoints :: create_proxy ( ) . context ( " " ) ? ; let ( launcher , launcher_server_end ) = fidl :: endpoints :: create_proxy ( ) . context ( " " ) ? ; // Component manager will run with these environment options let mut env_options = EnvironmentOptions { // This flag ensures that component manager gets all its required // services from the parent component inherit_parent_services : true , use_parent_runners : true , kill_on_oom : false , delete_storage_on_death : true , } ; env . create_nested_environment ( new_env_server_end , controller_server_end , label , None , & mut env_options , ) . context ( " " ) ? ; // Wait for the environment to be setup. // There is only one type of event (OnCreated) in this protocol, so just get the next one. let EnvironmentControllerEvent :: OnCreated { } = controller . take_event_stream ( ) . next ( ) . await . unwrap ( ) . unwrap ( ) ; // Get the launcher for this environment so it can be used to start component manager. new_env . get_launcher ( launcher_server_end ) . context ( " " ) ? ; Ok ( ( controller , launcher ) ) }
Creates an isolated environment for component manager inside this component.
Creates an isolated environment for component manager inside this component .
label
&str
label
&str