pub async fn route_runner(
    runner: &CapabilityName,
    target: &Arc<ComponentInstance>,
) -> Result<CapabilitySource, RoutingError> {
    // Find the component instance in which the runner was registered with the environment.
    let (env_component_instance, registration_decl) =
        match target.environment().get_registered_runner(&runner)? {
            Some((ExtendedInstance::Component(env_component_instance), registration_decl)) => {
                (env_component_instance, registration_decl)
            }
            Some((ExtendedInstance::AboveRoot(top_instance), reg)) => {
                // Root environment.
                return Ok(CapabilitySource::Builtin {
                    capability: InternalCapability::Runner(reg.source_name.clone()),
                    top_instance: Arc::downgrade(&top_instance),
                });
            }
            None => {
                return Err(RoutingError::UseFromEnvironmentNotFound {
                    moniker: target.abs_moniker.clone(),
                    capability_name: runner.clone(),
                    capability_type: "runner",
                }
                .into());
            }
        };

    let allowed_sources =
        AllowedSourcesBuilder::new().builtin(InternalCapability::Runner).component();
    RoutingStrategy::new()
        .registration::<RunnerRegistration>()
        .offer::<OfferRunnerDecl>()
        .expose::<ExposeRunnerDecl>()
        .route(registration_decl, env_component_instance, allowed_sources, &mut RunnerVisitor)
        .await
}
/// Finds a Runner capability that matches `runner` in the `target`'s environment, and then
/// routes the Runner capability from the environment's component instance to its source.
Finds a Runner capability that matches `runner` in the `target`'s environment, and then
routes the Runner capability from the environment's component instance to its source.
Finds a Runner capability that matches ` runner ` in the ` target ` ' s environment and then routes the Runner capability from the environment ' s component instance to its source .
pub async fn route_runner(
    runner: &CapabilityName,
    target: &Arc<ComponentInstance>,
) -> Result<CapabilitySource, RoutingError> {
    // Find the component instance in which the runner was registered with the environment.
    let (env_component_instance, registration_decl) =
        match target.environment().get_registered_runner(&runner)? {
            Some((ExtendedInstance::Component(env_component_instance), registration_decl)) => {
                (env_component_instance, registration_decl)
            }
            Some((ExtendedInstance::AboveRoot(top_instance), reg)) => {
                // Root environment.
                return Ok(CapabilitySource::Builtin {
                    capability: InternalCapability::Runner(reg.source_name.clone()),
                    top_instance: Arc::downgrade(&top_instance),
                });
            }
            None => {
                return Err(RoutingError::UseFromEnvironmentNotFound {
                    moniker: target.abs_moniker.clone(),
                    capability_name: runner.clone(),
                    capability_type: "runner",
                }
                .into());
            }
        };
    let allowed_sources =
        AllowedSourcesBuilder::new().builtin(InternalCapability::Runner).component();
    RoutingStrategy::new()
        .registration::<RunnerRegistration>()
        .offer::<OfferRunnerDecl>()
        .expose::<ExposeRunnerDecl>()
        .route(registration_decl, env_component_instance, allowed_sources, &mut RunnerVisitor)
        .await
}
pub async fn route_runner ( runner : & CapabilityName , target : & Arc < ComponentInstance > , ) -> Result < CapabilitySource , RoutingError > { // Find the component instance in which the runner was registered with the environment. let ( env_component_instance , registration_decl ) = match target . environment ( ) . get_registered_runner ( & runner ) ? { Some ( ( ExtendedInstance :: Component ( env_component_instance ) , registration_decl ) ) => { ( env_component_instance , registration_decl ) } Some ( ( ExtendedInstance :: AboveRoot ( top_instance ) , reg ) ) => { // Root environment. return Ok ( CapabilitySource :: Builtin { capability : InternalCapability :: Runner ( reg . source_name . clone ( ) ) , top_instance : Arc :: downgrade ( & top_instance ) , } ) ; } None => { return Err ( RoutingError :: UseFromEnvironmentNotFound { moniker : target . abs_moniker . clone ( ) , capability_name : runner . clone ( ) , capability_type : " " , } . into ( ) ) ; } } ; let allowed_sources = AllowedSourcesBuilder :: new ( ) . builtin ( InternalCapability :: Runner ) . component ( ) ; RoutingStrategy :: new ( ) . registration :: < RunnerRegistration > ( ) . offer :: < OfferRunnerDecl > ( ) . expose :: < ExposeRunnerDecl > ( ) . route ( registration_decl , env_component_instance , allowed_sources , & mut RunnerVisitor ) . await }
Finds a Runner capability that matches `runner` in the `target`'s environment, and then
routes the Runner capability from the environment's component instance to its source.
Finds a Runner capability that matches ` runner ` in the ` target ` ' s environment and then routes the Runner capability from the environment ' s component instance to its source .
runner
&CapabilityName
target
&Arc<ComponentInstance>
runner
&CapabilityName
target
&Arc<ComponentInstance>