pub fn spawn(self) -> Result<Environment, Error> {
        let mut nested_environment = None;

        let mut fs = ServiceFs::new();
        let service_dir =
            if let Runtime::Service(_) = self.runtime { fs.dir("svc") } else { fs.root_dir() };

        let mut settings = match self.configuration {
            Some(Configuration::All) => get_all_setting_types(),
            _ => HashSet::new(),
        };

        let service_context = ServiceContext::create(self.generate_service);

        for setting in self.settings {
            settings.insert(setting);
        }

        let mut handler_factory = SettingHandlerFactoryImpl::new(
            settings.clone(),
            service_context.clone(),
            self.storage_factory.clone(),
        );

        for (setting_type, handler) in self.handlers {
            handler_factory.register(setting_type, handler);
        }

        EnvironmentBuilder::get_configuration_handlers(&mut handler_factory);
        let rx = create_environment(
            service_dir,
            settings,
            self.agents,
            service_context,
            Arc::new(Mutex::new(handler_factory)),
        );

        match self.runtime {
            Runtime::Service(mut executor) => {
                fs.take_and_serve_directory_handle()?;
                let () = executor.run_singlethreaded(fs.collect());
            }
            Runtime::Nested(environment_name) => {
                nested_environment = Some(fs.create_salted_nested_environment(&environment_name)?);
                fasync::spawn(fs.collect());
            }
        }

        return Ok(Environment::new(nested_environment, rx));
    }
/// Spawns the environment based on previously set parameters.
Spawns the environment based on previously set parameters.
Spawns the environment based on previously set parameters .
pub fn spawn(self) -> Result<Environment, Error> {
        let mut nested_environment = None;
        let mut fs = ServiceFs::new();
        let service_dir =
            if let Runtime::Service(_) = self.runtime { fs.dir("svc") } else { fs.root_dir() };
        let mut settings = match self.configuration {
            Some(Configuration::All) => get_all_setting_types(),
            _ => HashSet::new(),
        };
        let service_context = ServiceContext::create(self.generate_service);
        for setting in self.settings {
            settings.insert(setting);
        }
        let mut handler_factory = SettingHandlerFactoryImpl::new(
            settings.clone(),
            service_context.clone(),
            self.storage_factory.clone(),
        );
        for (setting_type, handler) in self.handlers {
            handler_factory.register(setting_type, handler);
        }
        EnvironmentBuilder::get_configuration_handlers(&mut handler_factory);
        let rx = create_environment(
            service_dir,
            settings,
            self.agents,
            service_context,
            Arc::new(Mutex::new(handler_factory)),
        );
        match self.runtime {
            Runtime::Service(mut executor) => {
                fs.take_and_serve_directory_handle()?;
                let () = executor.run_singlethreaded(fs.collect());
            }
            Runtime::Nested(environment_name) => {
                nested_environment = Some(fs.create_salted_nested_environment(&environment_name)?);
                fasync::spawn(fs.collect());
            }
        }
        return Ok(Environment::new(nested_environment, rx));
    }
pub fn spawn ( self ) -> Result < Environment , Error > { let mut nested_environment = None ; let mut fs = ServiceFs :: new ( ) ; let service_dir = if let Runtime :: Service ( _ ) = self . runtime { fs . dir ( " " ) } else { fs . root_dir ( ) } ; let mut settings = match self . configuration { Some ( Configuration :: All ) => get_all_setting_types ( ) , _ => HashSet :: new ( ) , } ; let service_context = ServiceContext :: create ( self . generate_service ) ; for setting in self . settings { settings . insert ( setting ) ; } let mut handler_factory = SettingHandlerFactoryImpl :: new ( settings . clone ( ) , service_context . clone ( ) , self . storage_factory . clone ( ) , ) ; for ( setting_type , handler ) in self . handlers { handler_factory . register ( setting_type , handler ) ; } EnvironmentBuilder :: get_configuration_handlers ( & mut handler_factory ) ; let rx = create_environment ( service_dir , settings , self . agents , service_context , Arc :: new ( Mutex :: new ( handler_factory ) ) , ) ; match self . runtime { Runtime :: Service ( mut executor ) => { fs . take_and_serve_directory_handle ( ) ? ; let ( ) = executor . run_singlethreaded ( fs . collect ( ) ) ; } Runtime :: Nested ( environment_name ) => { nested_environment = Some ( fs . create_salted_nested_environment ( & environment_name ) ? ) ; fasync :: spawn ( fs . collect ( ) ) ; } } return Ok ( Environment :: new ( nested_environment , rx ) ) ; }
Spawns the environment based on previously set parameters.
Spawns the environment based on previously set parameters .
self
self