// A helper function validating a source of type `Capability` for a protocol capability.
// If the protocol is the `StorageAdmin` protocol, then it should have a valid storage
// source.
A helper function validating a source of type `Capability` for a protocol capability.
If the protocol is the `StorageAdmin` protocol, then it should have a valid storage
source.
A helper function validating a source of type ` Capability ` for a protocol capability . If the protocol is the ` StorageAdmin ` protocol then it should have a valid storage source .
fn check_protocol_capability_source(
        &self,
        source_component: &Arc<ComponentInstanceForAnalyzer>,
        source_capability: &ComponentCapability,
    ) -> Result<(), AnalyzerModelError> {
        let source_capability_name = source_capability
            .source_capability_name()
            .expect("failed to get source capability name");
        match source_capability.source_name().map(|name| name.to_string()).as_deref() {
            Some(fsys::StorageAdminMarker::NAME) => {
                match source_component.decl.find_storage_source(source_capability_name) {
                    Some(_) => Ok(()),
                    None => Err(AnalyzerModelError::InvalidSourceCapability(
                        source_capability_name.to_string(),
                        fsys::StorageAdminMarker::NAME.to_string(),
                    )),
                }
            }
            _ => Err(AnalyzerModelError::InvalidSourceCapability(
                source_capability_name.to_string(),
                source_capability
                    .source_name()
                    .map_or_else(|| "".to_string(), |name| name.to_string()),
            )),
        }
    }
fn check_protocol_capability_source ( & self , source_component : & Arc < ComponentInstanceForAnalyzer > , source_capability : & ComponentCapability , ) -> Result < ( ) , AnalyzerModelError > { let source_capability_name = source_capability . source_capability_name ( ) . expect ( " " ) ; match source_capability . source_name ( ) . map ( | name | name . to_string ( ) ) . as_deref ( ) { Some ( fsys :: StorageAdminMarker :: NAME ) => { match source_component . decl . find_storage_source ( source_capability_name ) { Some ( _ ) => Ok ( ( ) ) , None => Err ( AnalyzerModelError :: InvalidSourceCapability ( source_capability_name . to_string ( ) , fsys :: StorageAdminMarker :: NAME . to_string ( ) , ) ) , } } _ => Err ( AnalyzerModelError :: InvalidSourceCapability ( source_capability_name . to_string ( ) , source_capability . source_name ( ) . map_or_else ( | | " " . to_string ( ) , | name | name . to_string ( ) ) , ) ) , } }
A helper function validating a source of type `Capability` for a protocol capability.
A helper function validating a source of type ` Capability ` for a protocol capability .
&self
source_component
&Arc<ComponentInstanceForAnalyzer>
source_capability
&ComponentCapability