pub fn new_connection(
        &self,
        other: PeerId,
        connection: bredr::ConnectParameters,
    ) -> Result<bredr::Channel, Error> {
        match connection {
            bredr::ConnectParameters::L2cap(params) => {
                let psm = params.psm.ok_or(format_err!("No PSM provided"))?;
                self.new_l2cap_connection(other, Psm::new(psm))
            }
            bredr::ConnectParameters::Rfcomm(params) => {
                let server_channel =
                    params.channel.ok_or(format_err!("No Server Channel number provided"))?;
                let server_channel = ServerChannel::try_from(server_channel)
                    .map_err(|_| format_err!("Invalid server channel number"))?;
                self.new_rfcomm_connection(other, server_channel)
            }
        }
    }
/// Creates a new connection between this peer and the `other` peer.
///
/// `connection` specifies the connection type and parameters.
/// `other` specifies the PeerId of the peer initiating the connection.
///
/// Returns one end of the created connection on success, Error otherwise.
Creates a new connection between this peer and the `other` peer.
`connection` specifies the connection type and parameters.
`other` specifies the PeerId of the peer initiating the connection.

Returns one end of the created connection on success, Error otherwise.
Creates a new connection between this peer and the ` other ` peer . ` connection ` specifies the connection type and parameters . ` other ` specifies the PeerId of the peer initiating the connection . Returns one end of the created connection on success Error otherwise .
pub fn new_connection(
        &self,
        other: PeerId,
        connection: bredr::ConnectParameters,
    ) -> Result<bredr::Channel, Error> {
        match connection {
            bredr::ConnectParameters::L2cap(params) => {
                let psm = params.psm.ok_or(format_err!("No PSM provided"))?;
                self.new_l2cap_connection(other, Psm::new(psm))
            }
            bredr::ConnectParameters::Rfcomm(params) => {
                let server_channel =
                    params.channel.ok_or(format_err!("No Server Channel number provided"))?;
                let server_channel = ServerChannel::try_from(server_channel)
                    .map_err(|_| format_err!("Invalid server channel number"))?;
                self.new_rfcomm_connection(other, server_channel)
            }
        }
    }
pub fn new_connection ( & self , other : PeerId , connection : bredr :: ConnectParameters , ) -> Result < bredr :: Channel , Error > { match connection { bredr :: ConnectParameters :: L2cap ( params ) => { let psm = params . psm . ok_or ( format_err ! ( " " ) ) ? ; self . new_l2cap_connection ( other , Psm :: new ( psm ) ) } bredr :: ConnectParameters :: Rfcomm ( params ) => { let server_channel = params . channel . ok_or ( format_err ! ( " " ) ) ? ; let server_channel = ServerChannel :: try_from ( server_channel ) . map_err ( | _ | format_err ! ( " " ) ) ? ; self . new_rfcomm_connection ( other , server_channel ) } } }
Creates a new connection between this peer and the `other` peer.
Creates a new connection between this peer and the ` other ` peer .
&self
other
PeerId
connection
bredr::ConnectParameters
&self
other
PeerId
connection
bredr::ConnectParameters