/// Returns the Server Channel number from the provided `protocol` or None if the
/// protocol is not RFCOMM or is invalidly formatted.
Returns the Server Channel number from the provided `protocol` or None if the
protocol is not RFCOMM or is invalidly formatted.
Returns the Server Channel number from the provided ` protocol ` or None if the protocol is not RFCOMM or is invalidly formatted .
fn server_channel_from_protocol(
    protocol: &Vec<bredr::ProtocolDescriptor>,
) -> Option<ServerChannelNumber> {
    protocol
        .iter()
        .find(|descriptor| descriptor.protocol == bredr::ProtocolIdentifier::Rfcomm)
        .and_then(|rfcomm| match rfcomm.params.first() {
            Some(bredr::DataElement::Uint8(sc)) => Some(ServerChannelNumber(*sc)),
            _ => None,
        })
}
fn server_channel_from_protocol ( protocol : & Vec < bredr :: ProtocolDescriptor > , ) -> Option < ServerChannelNumber > { protocol . iter ( ) . find ( | descriptor | descriptor . protocol == bredr :: ProtocolIdentifier :: Rfcomm ) . and_then ( | rfcomm | match rfcomm . params . first ( ) { Some ( bredr :: DataElement :: Uint8 ( sc ) ) => Some ( ServerChannelNumber ( * sc ) ) , _ => None , } ) }
Returns the Server Channel number from the provided `protocol` or None if the
protocol is not RFCOMM or is invalidly formatted.
Returns the Server Channel number from the provided ` protocol ` or None if the protocol is not RFCOMM or is invalidly formatted .
protocol
&Vec<bredr::ProtocolDescriptor>