/// Walks the component tree to return the originating source of a capability, starting on the given
/// abs_moniker, as well as the final capability state.
Walks the component tree to return the originating source of a capability, starting on the given
abs_moniker, as well as the final capability state.
Walks the component tree to return the originating source of a capability starting on the given abs_moniker as well as the final capability state .
async fn find_capability_source<'a>(
    capability: ComponentCapability,
    target_realm: &'a Arc<Realm>,
) -> Result<(CapabilitySource, CapabilityState), ModelError> {
    let starting_realm = target_realm.try_get_parent()?;
    let cap_state = CapabilityState::new(&capability);
    let mut pos = WalkPosition {
        capability,
        cap_state,
        last_child_moniker: target_realm.abs_moniker.path().last().map(|c| c.clone()),
        realm: starting_realm,
    };
    if let Some(source) = walk_offer_chain(&mut pos).await? {
        return Ok((source, pos.cap_state));
    }
    let source = walk_expose_chain(&mut pos).await?;
    Ok((source, pos.cap_state))
}
async fn find_capability_source < ' a > ( capability : ComponentCapability , target_realm : & ' a Arc < Realm > , ) -> Result < ( CapabilitySource , CapabilityState ) , ModelError > { let starting_realm = target_realm . try_get_parent ( ) ? ; let cap_state = CapabilityState :: new ( & capability ) ; let mut pos = WalkPosition { capability , cap_state , last_child_moniker : target_realm . abs_moniker . path ( ) . last ( ) . map ( | c | c . clone ( ) ) , realm : starting_realm , } ; if let Some ( source ) = walk_offer_chain ( & mut pos ) . await ? { return Ok ( ( source , pos . cap_state ) ) ; } let source = walk_expose_chain ( & mut pos ) . await ? ; Ok ( ( source , pos . cap_state ) ) }
Walks the component tree to return the originating source of a capability, starting on the given
abs_moniker, as well as the final capability state.
Walks the component tree to return the originating source of a capability starting on the given abs_moniker as well as the final capability state .
capability
ComponentCapability
target_realm
&'a Arc<Realm>