/// Creates a new environment that only has access to the services provided through this
/// `ServiceFs` and the enclosing environment's `Loader` service.
///
/// Note that the resulting `NestedEnvironment` must be kept alive for the environment to
/// continue to exist. Once dropped, the environment and all components launched within it
/// will be destroyed.
Creates a new environment that only has access to the services provided through this
`ServiceFs` and the enclosing environment's `Loader` service.

Note that the resulting `NestedEnvironment` must be kept alive for the environment to
continue to exist. Once dropped, the environment and all components launched within it
will be destroyed.
Creates a new environment that only has access to the services provided through this ` ServiceFs ` and the enclosing environment ' s ` Loader ` service . Note that the resulting ` NestedEnvironment ` must be kept alive for the environment to continue to exist . Once dropped the environment and all components launched within it will be destroyed .
pub fn create_nested_environment<O>(
        &mut self,
        environment_label: &str,
    ) -> Result<NestedEnvironment, Error>
    where
        ServiceObjTy: From<Proxy<LoaderMarker, O>>,
        ServiceObjTy: ServiceObjTrait<Output = O>,
    {
        let env = crate::client::connect_to_service::<EnvironmentMarker>()
            .context("connecting to current environment")?;
        let services_with_loader = self.add_proxy_service::<LoaderMarker, _>();
        let mut service_list = services_with_loader.host_services_list()?;
        let (new_env, new_env_server_end) = fidl::endpoints::create_proxy()?;
        let (controller, controller_server_end) = fidl::endpoints::create_proxy()?;
        let (launcher, launcher_server_end) = fidl::endpoints::create_proxy()?;
        let (directory_request, directory_server_end) = zx::Channel::create()?;
        env.create_nested_environment(
            new_env_server_end,
            controller_server_end,
            environment_label,
            Some(fidl::encoding::OutOfLine(&mut service_list)),
            &mut EnvironmentOptions {
                inherit_parent_services: false,
                allow_parent_runners: false,
                kill_on_oom: false,
                delete_storage_on_death: false,
            },
        )
        .context("creating isolated environment")?;
        new_env.get_launcher(launcher_server_end).context("getting nested environment launcher")?;
        self.serve_connection(directory_server_end)?;
        Ok(NestedEnvironment { controller, launcher, directory_request })
    }
pub fn create_nested_environment < O > ( & mut self , environment_label : & str , ) -> Result < NestedEnvironment , Error > where ServiceObjTy : From < Proxy < LoaderMarker , O > > , ServiceObjTy : ServiceObjTrait < Output = O > , { let env = crate :: client :: connect_to_service :: < EnvironmentMarker > ( ) . context ( " " ) ? ; let services_with_loader = self . add_proxy_service :: < LoaderMarker , _ > ( ) ; let mut service_list = services_with_loader . host_services_list ( ) ? ; let ( new_env , new_env_server_end ) = fidl :: endpoints :: create_proxy ( ) ? ; let ( controller , controller_server_end ) = fidl :: endpoints :: create_proxy ( ) ? ; let ( launcher , launcher_server_end ) = fidl :: endpoints :: create_proxy ( ) ? ; let ( directory_request , directory_server_end ) = zx :: Channel :: create ( ) ? ; env . create_nested_environment ( new_env_server_end , controller_server_end , environment_label , Some ( fidl :: encoding :: OutOfLine ( & mut service_list ) ) , & mut EnvironmentOptions { inherit_parent_services : false , allow_parent_runners : false , kill_on_oom : false , delete_storage_on_death : false , } , ) . context ( " " ) ? ; new_env . get_launcher ( launcher_server_end ) . context ( " " ) ? ; self . serve_connection ( directory_server_end ) ? ; Ok ( NestedEnvironment { controller , launcher , directory_request } ) }
Creates a new environment that only has access to the services provided through this
`ServiceFs` and the enclosing environment's `Loader` service.
Creates a new environment that only has access to the services provided through this ` ServiceFs ` and the enclosing environment ' s ` Loader ` service .
&mut self
environment_label
&str