async fn launch_component_manager(
    launcher: LauncherProxy,
    component_manager_url: &str,
    root_component_url: &str,
    dir_handles: Vec<(String, zx::Handle)>,
    output_file_descriptor: Option<FileDescriptor>,
) -> Result<App, Error> {
    let mut options = LaunchOptions::new();

    // Redirect the output to the provided descriptor
    if let Some(output_file_descriptor) = output_file_descriptor {
        options.set_out(output_file_descriptor);
    }

    // Add in any provided directory handles to component manager's namespace
    for dir in dir_handles {
        options.add_handle_to_namespace(dir.0, dir.1);
    }

    // Start component manager, giving the debug flag and the root component URL.
    let component_manager_app = launch_with_options(
        &launcher,
        component_manager_url.to_string(),
        Some(vec![root_component_url.to_string(), "--debug".to_string()]),
        options,
    )
    .context("could not launch component manager")?;

    // Wait for component manager to setup the out directory
    let event_stream = component_manager_app.controller().take_event_stream();
    event_stream
        .try_filter_map(|event| {
            let event = match event {
                ComponentControllerEvent::OnDirectoryReady {} => Some(event),
                _ => None,
            };
            future::ready(Ok(event))
        })
        .next()
        .await;

    Ok(component_manager_app)
}
/// Use the provided launcher from the isolated environment to startup component manager.
/// Attach any provided directory handles. Component manager is provided the URL of the
/// v2 component to start and the debug flag. Blocks until the out directory of component
/// manager is set up.
Use the provided launcher from the isolated environment to startup component manager.
Attach any provided directory handles. Component manager is provided the URL of the
v2 component to start and the debug flag. Blocks until the out directory of component
manager is set up.
Use the provided launcher from the isolated environment to startup component manager . Attach any provided directory handles . Component manager is provided the URL of the v2 component to start and the debug flag . Blocks until the out directory of component manager is set up .
async fn launch_component_manager(
    launcher: LauncherProxy,
    component_manager_url: &str,
    root_component_url: &str,
    dir_handles: Vec<(String, zx::Handle)>,
    output_file_descriptor: Option<FileDescriptor>,
) -> Result<App, Error> {
    let mut options = LaunchOptions::new();
    // Redirect the output to the provided descriptor
    if let Some(output_file_descriptor) = output_file_descriptor {
        options.set_out(output_file_descriptor);
    }
    // Add in any provided directory handles to component manager's namespace
    for dir in dir_handles {
        options.add_handle_to_namespace(dir.0, dir.1);
    }
    // Start component manager, giving the debug flag and the root component URL.
    let component_manager_app = launch_with_options(
        &launcher,
        component_manager_url.to_string(),
        Some(vec![root_component_url.to_string(), "--debug".to_string()]),
        options,
    )
    .context("could not launch component manager")?;
    // Wait for component manager to setup the out directory
    let event_stream = component_manager_app.controller().take_event_stream();
    event_stream
        .try_filter_map(|event| {
            let event = match event {
                ComponentControllerEvent::OnDirectoryReady {} => Some(event),
                _ => None,
            };
            future::ready(Ok(event))
        })
        .next()
        .await;
    Ok(component_manager_app)
}
async fn launch_component_manager ( launcher : LauncherProxy , component_manager_url : & str , root_component_url : & str , dir_handles : Vec < ( String , zx :: Handle ) > , output_file_descriptor : Option < FileDescriptor > , ) -> Result < App , Error > { let mut options = LaunchOptions :: new ( ) ; // Redirect the output to the provided descriptor if let Some ( output_file_descriptor ) = output_file_descriptor { options . set_out ( output_file_descriptor ) ; } // Add in any provided directory handles to component manager's namespace for dir in dir_handles { options . add_handle_to_namespace ( dir . 0 , dir . 1 ) ; } // Start component manager, giving the debug flag and the root component URL. let component_manager_app = launch_with_options ( & launcher , component_manager_url . to_string ( ) , Some ( vec ! [ root_component_url to_string ( ) " " to_string ( ) ] ) , options , ) . context ( " " ) ? ; // Wait for component manager to setup the out directory let event_stream = component_manager_app . controller ( ) . take_event_stream ( ) ; event_stream . try_filter_map ( | event | { let event = match event { ComponentControllerEvent :: OnDirectoryReady { } => Some ( event ) , _ => None , } ; future :: ready ( Ok ( event ) ) } ) . next ( ) . await ; Ok ( component_manager_app ) }
Use the provided launcher from the isolated environment to startup component manager.
Use the provided launcher from the isolated environment to startup component manager .
launcher
LauncherProxy
component_manager_url
&str
root_component_url
&str
dir_handles
Vec<(String, zx::Handle)>
output_file_descriptor
Option<FileDescriptor>
launcher
LauncherProxy
component_manager_url
&str
root_component_url
&str
dir_handles
Vec<(String, zx::Handle)>
output_file_descriptor
Option<FileDescriptor>