pub fn clone_component_namespace(
    mut ns: fsys::ComponentNamespace,
) -> Result<(fsys::ComponentNamespace, fsys::ComponentNamespace), Error> {
    let mut old_dirs = Vec::new();
    let mut new_dirs = Vec::new();
    for dir in ns.directories.drain(..) {
        // Convert the directory into a Proxy and call Clone
        let dir_proxy = dir.into_proxy()?;
        let new_dir_proxy = io_util::clone_directory(&dir_proxy)?;

        // Convert the preexisting directory handle back into a ClientEnd and put it in old_dirs
        let dir_chan = dir_proxy.into_channel().map_err(|_| err_msg("into_channel failed"))?; // pretty sure this is impossible here
        old_dirs.push(ClientEnd::new(dir_chan.into_zx_channel()));

        // Convert the new directory handle into a ClientEnd and put it in new_dirs
        let new_dir_chan =
            new_dir_proxy.into_channel().map_err(|_| err_msg("into_channel failed"))?; // pretty sure this is impossible here
        new_dirs.push(ClientEnd::new(new_dir_chan.into_zx_channel()));
    }
    Ok((
        fsys::ComponentNamespace { paths: ns.paths.clone(), directories: old_dirs },
        fsys::ComponentNamespace { paths: ns.paths, directories: new_dirs },
    ))
}
/// clone_component_namespace will create a duplicate namespace struct, with different channels
/// (but to the same place) for the directories. It must take ownership of the namespace to be
/// cloned, because ownership is required to use the directory handles to call the FIDL clone
/// function.
clone_component_namespace will create a duplicate namespace struct, with different channels
(but to the same place) for the directories. It must take ownership of the namespace to be
cloned, because ownership is required to use the directory handles to call the FIDL clone
function.
clone_component_namespace will create a duplicate namespace struct with different channels ( but to the same place ) for the directories . It must take ownership of the namespace to be cloned because ownership is required to use the directory handles to call the FIDL clone function .
pub fn clone_component_namespace(
    mut ns: fsys::ComponentNamespace,
) -> Result<(fsys::ComponentNamespace, fsys::ComponentNamespace), Error> {
    let mut old_dirs = Vec::new();
    let mut new_dirs = Vec::new();
    for dir in ns.directories.drain(..) {
        // Convert the directory into a Proxy and call Clone
        let dir_proxy = dir.into_proxy()?;
        let new_dir_proxy = io_util::clone_directory(&dir_proxy)?;
        // Convert the preexisting directory handle back into a ClientEnd and put it in old_dirs
        let dir_chan = dir_proxy.into_channel().map_err(|_| err_msg("into_channel failed"))?; // pretty sure this is impossible here
        old_dirs.push(ClientEnd::new(dir_chan.into_zx_channel()));
        // Convert the new directory handle into a ClientEnd and put it in new_dirs
        let new_dir_chan =
            new_dir_proxy.into_channel().map_err(|_| err_msg("into_channel failed"))?; // pretty sure this is impossible here
        new_dirs.push(ClientEnd::new(new_dir_chan.into_zx_channel()));
    }
    Ok((
        fsys::ComponentNamespace { paths: ns.paths.clone(), directories: old_dirs },
        fsys::ComponentNamespace { paths: ns.paths, directories: new_dirs },
    ))
}
pub fn clone_component_namespace ( mut ns : fsys :: ComponentNamespace , ) -> Result < ( fsys :: ComponentNamespace , fsys :: ComponentNamespace ) , Error > { let mut old_dirs = Vec :: new ( ) ; let mut new_dirs = Vec :: new ( ) ; for dir in ns . directories . drain ( .. ) { // Convert the directory into a Proxy and call Clone let dir_proxy = dir . into_proxy ( ) ? ; let new_dir_proxy = io_util :: clone_directory ( & dir_proxy ) ? ; // Convert the preexisting directory handle back into a ClientEnd and put it in old_dirs let dir_chan = dir_proxy . into_channel ( ) . map_err ( | _ | err_msg ( " " ) ) ? ; // pretty sure this is impossible here old_dirs . push ( ClientEnd :: new ( dir_chan . into_zx_channel ( ) ) ) ; // Convert the new directory handle into a ClientEnd and put it in new_dirs let new_dir_chan = new_dir_proxy . into_channel ( ) . map_err ( | _ | err_msg ( " " ) ) ? ; // pretty sure this is impossible here new_dirs . push ( ClientEnd :: new ( new_dir_chan . into_zx_channel ( ) ) ) ; } Ok ( ( fsys :: ComponentNamespace { paths : ns . paths . clone ( ) , directories : old_dirs } , fsys :: ComponentNamespace { paths : ns . paths , directories : new_dirs } , ) ) }
clone_component_namespace will create a duplicate namespace struct, with different channels
(but to the same place) for the directories.
clone_component_namespace will create a duplicate namespace struct with different channels ( but to the same place ) for the directories .
ns
fsys::ComponentNamespace
ns
fsys::ComponentNamespace