fn find_component_manager_in_hub(component_manager_url: &str, label: &str) -> PathBuf {
    let path_to_env = format!("/hub/r/{}", label);

    // Get the id for the environment
    let dir: Vec<DirEntry> = read_dir(path_to_env)
        // TODO convert this to an error instead of causing a panic
        .expect("could not open nested environment in the hub")
        .map(|x| x.expect("entry unreadable"))
        .collect();

    // There can only be one environment with this label.
    // So there should be only one id.
    assert_eq!(dir.len(), 1);

    // Since the component manager URL can be custom, we need to extract the
    // component name.
    let component_name = component_manager_url
        .split("/")
        .last()
        .expect("the URL for component manager must have at least one '/' character");

    let path_to_cm = dir[0].path().join("c").join(component_name);

    // Get the id for component manager
    let dir: Vec<DirEntry> = read_dir(path_to_cm)
        // TOOD convert this into an error instead of causing a panic
        .expect("could not open component manager in the hub")
        .map(|x| x.expect("entry unreadable"))
        .collect();

    // There can only be one component manager inside this environment.
    // So there should be only one id.
    assert_eq!(dir.len(), 1);

    dir[0].path()
}
/// Explore the hub to find the component manager running in the environment
/// marked by the provided label.
Explore the hub to find the component manager running in the environment
marked by the provided label.
Explore the hub to find the component manager running in the environment marked by the provided label .
fn find_component_manager_in_hub(component_manager_url: &str, label: &str) -> PathBuf {
    let path_to_env = format!("/hub/r/{}", label);
    // Get the id for the environment
    let dir: Vec<DirEntry> = read_dir(path_to_env)
        // TODO convert this to an error instead of causing a panic
        .expect("could not open nested environment in the hub")
        .map(|x| x.expect("entry unreadable"))
        .collect();
    // There can only be one environment with this label.
    // So there should be only one id.
    assert_eq!(dir.len(), 1);
    // Since the component manager URL can be custom, we need to extract the
    // component name.
    let component_name = component_manager_url
        .split("/")
        .last()
        .expect("the URL for component manager must have at least one '/' character");
    let path_to_cm = dir[0].path().join("c").join(component_name);
    // Get the id for component manager
    let dir: Vec<DirEntry> = read_dir(path_to_cm)
        // TOOD convert this into an error instead of causing a panic
        .expect("could not open component manager in the hub")
        .map(|x| x.expect("entry unreadable"))
        .collect();
    // There can only be one component manager inside this environment.
    // So there should be only one id.
    assert_eq!(dir.len(), 1);
    dir[0].path()
}
fn find_component_manager_in_hub ( component_manager_url : & str , label : & str ) -> PathBuf { let path_to_env = format ! ( " " label ) ; // Get the id for the environment let dir : Vec < DirEntry > = read_dir ( path_to_env ) // TODO convert this to an error instead of causing a panic . expect ( " " ) . map ( | x | x . expect ( " " ) ) . collect ( ) ; // There can only be one environment with this label. // So there should be only one id. assert_eq ! ( dir len ( ) 1 ) ; // Since the component manager URL can be custom, we need to extract the // component name. let component_name = component_manager_url . split ( " " ) . last ( ) . expect ( " " ) ; let path_to_cm = dir [ 0 ] . path ( ) . join ( " " ) . join ( component_name ) ; // Get the id for component manager let dir : Vec < DirEntry > = read_dir ( path_to_cm ) // TOOD convert this into an error instead of causing a panic . expect ( " " ) . map ( | x | x . expect ( " " ) ) . collect ( ) ; // There can only be one component manager inside this environment. // So there should be only one id. assert_eq ! ( dir len ( ) 1 ) ; dir [ 0 ] . path ( ) }
Explore the hub to find the component manager running in the environment
marked by the provided label.
Explore the hub to find the component manager running in the environment marked by the provided label .
component_manager_url
&str
label
&str
component_manager_url
&str
label
&str