pub fn find_offer_source<'a>(
        &self,
        decl: &'a ComponentDecl,
        child_moniker: &ChildMoniker,
    ) -> Option<&'a OfferDecl> {
        decl.offers.iter().find(|&offer| match (self, offer) {
            // Protocol offered to me that matches a service `use` or `offer` declaration.
            (
                ComponentCapability::Use(UseDecl::Protocol(child_use)),
                OfferDecl::Protocol(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_use.source_path,
                &offer.target,
                &offer.target_path,
            ),
            (
                ComponentCapability::Offer(OfferDecl::Protocol(child_offer)),
                OfferDecl::Protocol(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_offer.source_path,
                &offer.target,
                &offer.target_path,
            ),
            // Directory offered to me that matches a directory `use` or `offer` declaration.
            (
                ComponentCapability::Use(UseDecl::Directory(child_use)),
                OfferDecl::Directory(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_use.source_path,
                &offer.target,
                &offer.target_path,
            ),
            (
                ComponentCapability::Offer(OfferDecl::Directory(child_offer)),
                OfferDecl::Directory(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_offer.source_path,
                &offer.target,
                &offer.target_path,
            ),
            // Directory offered to me that matches a `storage` declaration which consumes it.
            (ComponentCapability::Storage(child_storage), OfferDecl::Directory(offer)) => {
                Self::is_offer_protocol_or_directory_match(
                    child_moniker,
                    &child_storage.source_path,
                    &offer.target,
                    &offer.target_path,
                )
            }
            // Storage offered to me.
            (ComponentCapability::Use(UseDecl::Storage(child_use)), OfferDecl::Storage(offer)) => {
                Self::is_offer_storage_match(
                    child_moniker,
                    child_use.type_(),
                    offer.target(),
                    offer.type_(),
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Storage(child_offer)),
                OfferDecl::Storage(offer),
            ) => Self::is_offer_storage_match(
                child_moniker,
                child_offer.type_(),
                offer.target(),
                offer.type_(),
            ),
            // Runners offered from parent.
            (ComponentCapability::Use(UseDecl::Runner(child_use)), OfferDecl::Runner(offer)) => {
                Self::is_offer_runner_or_event_match(
                    child_moniker,
                    &child_use.source_name,
                    &offer.target,
                    &offer.target_name,
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Runner(child_offer)),
                OfferDecl::Runner(parent_offer),
            ) => Self::is_offer_runner_or_event_match(
                child_moniker,
                &child_offer.source_name,
                &parent_offer.target,
                &parent_offer.target_name,
            ),
            // Events offered from parent.
            (ComponentCapability::Use(UseDecl::Event(child_use)), OfferDecl::Event(offer)) => {
                Self::is_offer_runner_or_event_match(
                    child_moniker,
                    &child_use.source_name,
                    &offer.target,
                    &offer.target_name,
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Event(child_offer)),
                OfferDecl::Event(parent_offer),
            ) => Self::is_offer_runner_or_event_match(
                child_moniker,
                &child_offer.source_name,
                &parent_offer.target,
                &parent_offer.target_name,
            ),
            _ => false,
        })
    }
/// Given a parent ComponentDecl, returns the `OfferDecl` that offers this capability to
/// `child_moniker`, if it exists.
Given a parent ComponentDecl, returns the `OfferDecl` that offers this capability to
`child_moniker`, if it exists.
Given a parent ComponentDecl returns the ` OfferDecl ` that offers this capability to ` child_moniker ` if it exists .
pub fn find_offer_source<'a>(
        &self,
        decl: &'a ComponentDecl,
        child_moniker: &ChildMoniker,
    ) -> Option<&'a OfferDecl> {
        decl.offers.iter().find(|&offer| match (self, offer) {
            // Protocol offered to me that matches a service `use` or `offer` declaration.
            (
                ComponentCapability::Use(UseDecl::Protocol(child_use)),
                OfferDecl::Protocol(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_use.source_path,
                &offer.target,
                &offer.target_path,
            ),
            (
                ComponentCapability::Offer(OfferDecl::Protocol(child_offer)),
                OfferDecl::Protocol(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_offer.source_path,
                &offer.target,
                &offer.target_path,
            ),
            // Directory offered to me that matches a directory `use` or `offer` declaration.
            (
                ComponentCapability::Use(UseDecl::Directory(child_use)),
                OfferDecl::Directory(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_use.source_path,
                &offer.target,
                &offer.target_path,
            ),
            (
                ComponentCapability::Offer(OfferDecl::Directory(child_offer)),
                OfferDecl::Directory(offer),
            ) => Self::is_offer_protocol_or_directory_match(
                child_moniker,
                &child_offer.source_path,
                &offer.target,
                &offer.target_path,
            ),
            // Directory offered to me that matches a `storage` declaration which consumes it.
            (ComponentCapability::Storage(child_storage), OfferDecl::Directory(offer)) => {
                Self::is_offer_protocol_or_directory_match(
                    child_moniker,
                    &child_storage.source_path,
                    &offer.target,
                    &offer.target_path,
                )
            }
            // Storage offered to me.
            (ComponentCapability::Use(UseDecl::Storage(child_use)), OfferDecl::Storage(offer)) => {
                Self::is_offer_storage_match(
                    child_moniker,
                    child_use.type_(),
                    offer.target(),
                    offer.type_(),
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Storage(child_offer)),
                OfferDecl::Storage(offer),
            ) => Self::is_offer_storage_match(
                child_moniker,
                child_offer.type_(),
                offer.target(),
                offer.type_(),
            ),
            // Runners offered from parent.
            (ComponentCapability::Use(UseDecl::Runner(child_use)), OfferDecl::Runner(offer)) => {
                Self::is_offer_runner_or_event_match(
                    child_moniker,
                    &child_use.source_name,
                    &offer.target,
                    &offer.target_name,
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Runner(child_offer)),
                OfferDecl::Runner(parent_offer),
            ) => Self::is_offer_runner_or_event_match(
                child_moniker,
                &child_offer.source_name,
                &parent_offer.target,
                &parent_offer.target_name,
            ),
            // Events offered from parent.
            (ComponentCapability::Use(UseDecl::Event(child_use)), OfferDecl::Event(offer)) => {
                Self::is_offer_runner_or_event_match(
                    child_moniker,
                    &child_use.source_name,
                    &offer.target,
                    &offer.target_name,
                )
            }
            (
                ComponentCapability::Offer(OfferDecl::Event(child_offer)),
                OfferDecl::Event(parent_offer),
            ) => Self::is_offer_runner_or_event_match(
                child_moniker,
                &child_offer.source_name,
                &parent_offer.target,
                &parent_offer.target_name,
            ),
            _ => false,
        })
    }
pub fn find_offer_source < ' a > ( & self , decl : & ' a ComponentDecl , child_moniker : & ChildMoniker , ) -> Option < & ' a OfferDecl > { decl . offers . iter ( ) . find ( | & offer | match ( self , offer ) { // Protocol offered to me that matches a service `use` or `offer` declaration. ( ComponentCapability :: Use ( UseDecl :: Protocol ( child_use ) ) , OfferDecl :: Protocol ( offer ) , ) => Self :: is_offer_protocol_or_directory_match ( child_moniker , & child_use . source_path , & offer . target , & offer . target_path , ) , ( ComponentCapability :: Offer ( OfferDecl :: Protocol ( child_offer ) ) , OfferDecl :: Protocol ( offer ) , ) => Self :: is_offer_protocol_or_directory_match ( child_moniker , & child_offer . source_path , & offer . target , & offer . target_path , ) , // Directory offered to me that matches a directory `use` or `offer` declaration. ( ComponentCapability :: Use ( UseDecl :: Directory ( child_use ) ) , OfferDecl :: Directory ( offer ) , ) => Self :: is_offer_protocol_or_directory_match ( child_moniker , & child_use . source_path , & offer . target , & offer . target_path , ) , ( ComponentCapability :: Offer ( OfferDecl :: Directory ( child_offer ) ) , OfferDecl :: Directory ( offer ) , ) => Self :: is_offer_protocol_or_directory_match ( child_moniker , & child_offer . source_path , & offer . target , & offer . target_path , ) , // Directory offered to me that matches a `storage` declaration which consumes it. ( ComponentCapability :: Storage ( child_storage ) , OfferDecl :: Directory ( offer ) ) => { Self :: is_offer_protocol_or_directory_match ( child_moniker , & child_storage . source_path , & offer . target , & offer . target_path , ) } // Storage offered to me. ( ComponentCapability :: Use ( UseDecl :: Storage ( child_use ) ) , OfferDecl :: Storage ( offer ) ) => { Self :: is_offer_storage_match ( child_moniker , child_use . type_ ( ) , offer . target ( ) , offer . type_ ( ) , ) } ( ComponentCapability :: Offer ( OfferDecl :: Storage ( child_offer ) ) , OfferDecl :: Storage ( offer ) , ) => Self :: is_offer_storage_match ( child_moniker , child_offer . type_ ( ) , offer . target ( ) , offer . type_ ( ) , ) , // Runners offered from parent. ( ComponentCapability :: Use ( UseDecl :: Runner ( child_use ) ) , OfferDecl :: Runner ( offer ) ) => { Self :: is_offer_runner_or_event_match ( child_moniker , & child_use . source_name , & offer . target , & offer . target_name , ) } ( ComponentCapability :: Offer ( OfferDecl :: Runner ( child_offer ) ) , OfferDecl :: Runner ( parent_offer ) , ) => Self :: is_offer_runner_or_event_match ( child_moniker , & child_offer . source_name , & parent_offer . target , & parent_offer . target_name , ) , // Events offered from parent. ( ComponentCapability :: Use ( UseDecl :: Event ( child_use ) ) , OfferDecl :: Event ( offer ) ) => { Self :: is_offer_runner_or_event_match ( child_moniker , & child_use . source_name , & offer . target , & offer . target_name , ) } ( ComponentCapability :: Offer ( OfferDecl :: Event ( child_offer ) ) , OfferDecl :: Event ( parent_offer ) , ) => Self :: is_offer_runner_or_event_match ( child_moniker , & child_offer . source_name , & parent_offer . target , & parent_offer . target_name , ) , _ => false , } ) }
Given a parent ComponentDecl, returns the `OfferDecl` that offers this capability to
`child_moniker`, if it exists.
Given a parent ComponentDecl returns the ` OfferDecl ` that offers this capability to ` child_moniker ` if it exists .
&self
decl
&'a ComponentDecl
child_moniker
&ChildMoniker
&self
decl
&'a ComponentDecl
child_moniker
&ChildMoniker