pub fn resolve_nl_mcast_group(
        &mut self,
        family_name: &str,
        mcast_name: &str,
    ) -> Result<u32, NlError> {
        let nlhdrs = self.get_genl_family(family_name)?;
        for nlhdr in nlhdrs {
            let attrs = nlhdr
                .nl_payload
                .get_payload()
                .ok_or_else(|| NlError::new("No attributes were returned in this message."))?;
            let mut handle = attrs.get_attr_handle();
            let mcast_groups = handle.get_nested_attributes::<Index>(CtrlAttr::McastGroups)?;
            if let Some(id) = mcast_groups
                .iter()
                .filter_map(|item| {
                    let nested_attrs = item.get_attr_handle::<CtrlAttrMcastGrp>().ok()?;
                    let string = nested_attrs
                        .get_attr_payload_as::<String>(CtrlAttrMcastGrp::Name)
                        .ok()?;
                    if string.as_str() == mcast_name {
                        nested_attrs
                            .get_attr_payload_as::<u32>(CtrlAttrMcastGrp::Id)
                            .ok()
                    } else {
                        None
                    }
                })
                .next()
            {
                return Ok(id);
            }
        }
        Err(NlError::new("Failed to resolve multicast group ID"))
    }
/// Convenience function for resolving a [`str`] containing the
/// multicast group name to a numeric multicast group ID.
Convenience function for resolving a [`str`] containing the
multicast group name to a numeric multicast group ID.
Convenience function for resolving a [ ` str ` ] containing the multicast group name to a numeric multicast group ID .
pub fn resolve_nl_mcast_group(
        &mut self,
        family_name: &str,
        mcast_name: &str,
    ) -> Result<u32, NlError> {
        let nlhdrs = self.get_genl_family(family_name)?;
        for nlhdr in nlhdrs {
            let attrs = nlhdr
                .nl_payload
                .get_payload()
                .ok_or_else(|| NlError::new("No attributes were returned in this message."))?;
            let mut handle = attrs.get_attr_handle();
            let mcast_groups = handle.get_nested_attributes::<Index>(CtrlAttr::McastGroups)?;
            if let Some(id) = mcast_groups
                .iter()
                .filter_map(|item| {
                    let nested_attrs = item.get_attr_handle::<CtrlAttrMcastGrp>().ok()?;
                    let string = nested_attrs
                        .get_attr_payload_as::<String>(CtrlAttrMcastGrp::Name)
                        .ok()?;
                    if string.as_str() == mcast_name {
                        nested_attrs
                            .get_attr_payload_as::<u32>(CtrlAttrMcastGrp::Id)
                            .ok()
                    } else {
                        None
                    }
                })
                .next()
            {
                return Ok(id);
            }
        }
        Err(NlError::new("Failed to resolve multicast group ID"))
    }
pub fn resolve_nl_mcast_group ( & mut self , family_name : & str , mcast_name : & str , ) -> Result < u32 , NlError > { let nlhdrs = self . get_genl_family ( family_name ) ? ; for nlhdr in nlhdrs { let attrs = nlhdr . nl_payload . get_payload ( ) . ok_or_else ( | | NlError :: new ( " " ) ) ? ; let mut handle = attrs . get_attr_handle ( ) ; let mcast_groups = handle . get_nested_attributes :: < Index > ( CtrlAttr :: McastGroups ) ? ; if let Some ( id ) = mcast_groups . iter ( ) . filter_map ( | item | { let nested_attrs = item . get_attr_handle :: < CtrlAttrMcastGrp > ( ) . ok ( ) ? ; let string = nested_attrs . get_attr_payload_as :: < String > ( CtrlAttrMcastGrp :: Name ) . ok ( ) ? ; if string . as_str ( ) == mcast_name { nested_attrs . get_attr_payload_as :: < u32 > ( CtrlAttrMcastGrp :: Id ) . ok ( ) } else { None } } ) . next ( ) { return Ok ( id ) ; } } Err ( NlError :: new ( " " ) ) }
Convenience function for resolving a [`str`] containing the
multicast group name to a numeric multicast group ID.
Convenience function for resolving a [ ` str ` ] containing the multicast group name to a numeric multicast group ID .
&mut self
family_name
&str
mcast_name
&str
&mut self
family_name
&str
mcast_name
&str