pub fn find_profile_descriptors(attributes: &[Attribute]) -> Result<Vec<ProfileDescriptor>, Error> {
    for attr in attributes {
        match attr.id {
            ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST => {
                if let DataElement::Sequence(profiles) = &attr.element {
                    let mut result = Vec::new();
                    for elem in profiles {
                        let elem = elem
                            .as_ref()
                            .ok_or(format_err!("DataElements in sequences shouldn't be null"))?;
                        result.push(
                            elem_to_profile_descriptor(&*elem)
                                .ok_or(format_err!("Couldn't convert to a ProfileDescriptor"))?,
                        );
                    }
                    if result.is_empty() {
                        return Err(format_err!("Profile Descriptor List had no profiles!"));
                    }
                    return Ok(result);
                } else {
                    return Err(format_err!(
                        "Profile Descriptor List Element was not formatted correctly"
                    ));
                }
            }
            _ => {}
        }
    }
    Err(format_err!("Profile Descriptor not found"))
}
/// Find an element representing the Bluetooth Profile Descriptor List in `attributes`, and
/// convert the elements in the list into ProfileDescriptors.
/// Returns an Error if no matching element was found, or if any element of the list couldn't be converted
/// into a ProfileDescriptor.
Find an element representing the Bluetooth Profile Descriptor List in `attributes`, and
convert the elements in the list into ProfileDescriptors.
Returns an Error if no matching element was found, or if any element of the list couldn't be converted
into a ProfileDescriptor.
Find an element representing the Bluetooth Profile Descriptor List in ` attributes ` and convert the elements in the list into ProfileDescriptors . Returns an Error if no matching element was found or if any element of the list couldn ' t be converted into a ProfileDescriptor .
pub fn find_profile_descriptors(attributes: &[Attribute]) -> Result<Vec<ProfileDescriptor>, Error> {
    for attr in attributes {
        match attr.id {
            ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST => {
                if let DataElement::Sequence(profiles) = &attr.element {
                    let mut result = Vec::new();
                    for elem in profiles {
                        let elem = elem
                            .as_ref()
                            .ok_or(format_err!("DataElements in sequences shouldn't be null"))?;
                        result.push(
                            elem_to_profile_descriptor(&*elem)
                                .ok_or(format_err!("Couldn't convert to a ProfileDescriptor"))?,
                        );
                    }
                    if result.is_empty() {
                        return Err(format_err!("Profile Descriptor List had no profiles!"));
                    }
                    return Ok(result);
                } else {
                    return Err(format_err!(
                        "Profile Descriptor List Element was not formatted correctly"
                    ));
                }
            }
            _ => {}
        }
    }
    Err(format_err!("Profile Descriptor not found"))
}
pub fn find_profile_descriptors ( attributes : & [ Attribute ] ) -> Result < Vec < ProfileDescriptor > , Error > { for attr in attributes { match attr . id { ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST => { if let DataElement :: Sequence ( profiles ) = & attr . element { let mut result = Vec :: new ( ) ; for elem in profiles { let elem = elem . as_ref ( ) . ok_or ( format_err ! ( " " ) ) ? ; result . push ( elem_to_profile_descriptor ( & * elem ) . ok_or ( format_err ! ( " " ) ) ? , ) ; } if result . is_empty ( ) { return Err ( format_err ! ( " " ) ) ; } return Ok ( result ) ; } else { return Err ( format_err ! ( " " ) ) ; } } _ => { } } } Err ( format_err ! ( " " ) ) }
Find an element representing the Bluetooth Profile Descriptor List in `attributes`, and
convert the elements in the list into ProfileDescriptors.
Find an element representing the Bluetooth Profile Descriptor List in ` attributes ` and convert the elements in the list into ProfileDescriptors .
attributes
&[Attribute]
attributes
&[Attribute]