fn visit_child_components(
    child_components_dir: Directory,
    subcommand: Subcommand,
) -> BoxFuture<'static, Vec<V1Component>> {
    async move {
        let mut component_names =
            child_components_dir.entries().await.expect("Could not get entries from directory.");
        let proxy = Arc::new(child_components_dir);
        join_all(component_names.drain(..).map(move |component_name| {
            let proxy = proxy.clone();
            async move {
                // Visits */c/<component name>/<component instance id>.
                let id_dir = proxy.open_dir(&component_name).expect(
                    format!("open_dir() failed: failed to open `{}` directory!", &component_name)
                        .as_str(),
                );
                join_all(
                    open_id_directories(id_dir)
                        .await
                        .drain(..)
                        .map(|d| V1Component::create(d, subcommand.clone())),
                )
                .await
            }
        }))
        .await
        .drain(..)
        .flatten()
        .collect()
    }
    .boxed()
}
/// Traverses a directory of named components, and recurses into each component directory.
/// Each component visited is added to the |child_components| vector.
Traverses a directory of named components, and recurses into each component directory.
Each component visited is added to the |child_components| vector.
Traverses a directory of named components and recurses into each component directory . Each component visited is added to the |child_components| vector .
fn visit_child_components(
    child_components_dir: Directory,
    subcommand: Subcommand,
) -> BoxFuture<'static, Vec<V1Component>> {
    async move {
        let mut component_names =
            child_components_dir.entries().await.expect("Could not get entries from directory.");
        let proxy = Arc::new(child_components_dir);
        join_all(component_names.drain(..).map(move |component_name| {
            let proxy = proxy.clone();
            async move {
                // Visits */c/<component name>/<component instance id>.
                let id_dir = proxy.open_dir(&component_name).expect(
                    format!("open_dir() failed: failed to open `{}` directory!", &component_name)
                        .as_str(),
                );
                join_all(
                    open_id_directories(id_dir)
                        .await
                        .drain(..)
                        .map(|d| V1Component::create(d, subcommand.clone())),
                )
                .await
            }
        }))
        .await
        .drain(..)
        .flatten()
        .collect()
    }
    .boxed()
}
fn visit_child_components ( child_components_dir : Directory , subcommand : Subcommand , ) -> BoxFuture < ' static , Vec < V1Component > > { async move { let mut component_names = child_components_dir . entries ( ) . await . expect ( " " ) ; let proxy = Arc :: new ( child_components_dir ) ; join_all ( component_names . drain ( .. ) . map ( move | component_name | { let proxy = proxy . clone ( ) ; async move { // Visits */c/<component name>/<component instance id>. let id_dir = proxy . open_dir ( & component_name ) . expect ( format ! ( " " component_name ) . as_str ( ) , ) ; join_all ( open_id_directories ( id_dir ) . await . drain ( .. ) . map ( | d | V1Component :: create ( d , subcommand . clone ( ) ) ) , ) . await } } ) ) . await . drain ( .. ) . flatten ( ) . collect ( ) } . boxed ( ) }
Traverses a directory of named components, and recurses into each component directory.
Traverses a directory of named components and recurses into each component directory .
child_components_dir
Directory
subcommand
Subcommand
child_components_dir
Directory
subcommand
Subcommand