/// In addition to populating an fsys::ComponentNamespace, `populate` will start serving and install
/// handles to pseudo directories.
In addition to populating an fsys::ComponentNamespace, `populate` will start serving and install
handles to pseudo directories.
In addition to populating an fsys :: ComponentNamespace ` populate ` will start serving and install handles to pseudo directories .
pub async fn populate<'a>(
        &'a mut self,
        model: Model,
        abs_moniker: &'a AbsoluteMoniker,
        decl: &'a ComponentDecl,
    ) -> Result<fsys::ComponentNamespace, ModelError> {
        let mut ns = fsys::ComponentNamespace { paths: vec![], directories: vec![] };
        // Populate the /pkg namespace.
        if let Some(package_dir) = self.package_dir.as_ref() {
            Self::add_pkg_directory(&mut ns, package_dir)?;
        }
        // Populate the namespace from uses, using the component manager's namespace.
        // svc_dirs will hold (path,directory) pairs. Each pair holds a path in the
        // component's namespace and a directory that ComponentMgr will host for the component.
        let mut svc_dirs = HashMap::new();
        // directory_waiters will hold Future<Output=()> objects that will wait for activity on
        // a channel and then route the channel to the appropriate component's out directory.
        let mut directory_waiters = Vec::new();
        for use_ in &decl.uses {
            match use_ {
                cm_rust::UseDecl::Directory(d) => {
                    Self::add_directory_use(
                        &mut ns,
                        &mut directory_waiters,
                        d,
                        model.clone(),
                        abs_moniker.clone(),
                    )?;
                }
                cm_rust::UseDecl::Service(s) => {
                    Self::add_service_use(&mut svc_dirs, s, model.clone(), abs_moniker.clone())?;
                }
            }
        }
        // Start hosting the services directories and add them to the namespace
        self.serve_and_install_svc_dirs(&mut ns, svc_dirs)?;
        self.start_directory_waiters(directory_waiters)?;
        Ok(ns)
    }
pub async fn populate < ' a > ( & ' a mut self , model : Model , abs_moniker : & ' a AbsoluteMoniker , decl : & ' a ComponentDecl , ) -> Result < fsys :: ComponentNamespace , ModelError > { let mut ns = fsys :: ComponentNamespace { paths : vec ! [ ] , directories : vec ! [ ] } ; // Populate the /pkg namespace. if let Some ( package_dir ) = self . package_dir . as_ref ( ) { Self :: add_pkg_directory ( & mut ns , package_dir ) ? ; } // Populate the namespace from uses, using the component manager's namespace. // svc_dirs will hold (path,directory) pairs. Each pair holds a path in the // component's namespace and a directory that ComponentMgr will host for the component. let mut svc_dirs = HashMap :: new ( ) ; // directory_waiters will hold Future<Output=()> objects that will wait for activity on // a channel and then route the channel to the appropriate component's out directory. let mut directory_waiters = Vec :: new ( ) ; for use_ in & decl . uses { match use_ { cm_rust :: UseDecl :: Directory ( d ) => { Self :: add_directory_use ( & mut ns , & mut directory_waiters , d , model . clone ( ) , abs_moniker . clone ( ) , ) ? ; } cm_rust :: UseDecl :: Service ( s ) => { Self :: add_service_use ( & mut svc_dirs , s , model . clone ( ) , abs_moniker . clone ( ) ) ? ; } } } // Start hosting the services directories and add them to the namespace self . serve_and_install_svc_dirs ( & mut ns , svc_dirs ) ? ; self . start_directory_waiters ( directory_waiters ) ? ; Ok ( ns ) }
In addition to populating an fsys::ComponentNamespace, `populate` will start serving and install
handles to pseudo directories.
In addition to populating an fsys :: ComponentNamespace ` populate ` will start serving and install handles to pseudo directories .
&'a mut self
model
Model
abs_moniker
&'a AbsoluteMoniker
decl
&'a ComponentDecl