Function multistream_select::dialer_select_proto

source ·
pub fn dialer_select_proto<R, I>(
    inner: R,
    protocols: I,
    version: Version,
) -> DialerSelectFuture<R, I::IntoIter> 
where R: AsyncRead + AsyncWrite, I: IntoIterator, I::Item: AsRef<[u8]>,
Expand description

Returns a Future that negotiates a protocol on the given I/O stream for a peer acting as the dialer (or initiator).

This function is given an I/O stream and a list of protocols and returns a computation that performs the protocol negotiation with the remote. The returned Future resolves with the name of the negotiated protocol and a Negotiated I/O stream.

Within the scope of this library, a dialer always commits to a specific multistream-select Version, whereas a listener always supports all versions supported by this library. Frictionless multistream-select protocol upgrades may thus proceed by deployments with updated listeners, eventually followed by deployments of dialers choosing the newer protocol.