async fn write_magic_and_version<S: AsyncWrite + Send + Unpin>(
  mut stream: S,
  protocol_version: u8,
) -> Result<S, NegotiationError> {
  stream
    .write_all(SNOCAT_NEGOTIATION_MAGIC)
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  stream
    .write_u8(protocol_version)
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  stream
    .flush()
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  Result::<S, NegotiationError>::Ok(stream)
}
/// Write future to send our magic and version to the remote,
/// returning an error if writes are refused by the stream.
Write future to send our magic and version to the remote,
returning an error if writes are refused by the stream.
Write future to send our magic and version to the remote returning an error if writes are refused by the stream .
async fn write_magic_and_version<S: AsyncWrite + Send + Unpin>(
  mut stream: S,
  protocol_version: u8,
) -> Result<S, NegotiationError> {
  stream
    .write_all(SNOCAT_NEGOTIATION_MAGIC)
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  stream
    .write_u8(protocol_version)
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  stream
    .flush()
    .await
    .map_err(|_| NegotiationError::WriteError)?;
  Result::<S, NegotiationError>::Ok(stream)
}
async fn write_magic_and_version < S : AsyncWrite + Send + Unpin > ( mut stream : S , protocol_version : u8 , ) -> Result < S , NegotiationError > { stream . write_all ( SNOCAT_NEGOTIATION_MAGIC ) . await . map_err ( | _ | NegotiationError :: WriteError ) ? ; stream . write_u8 ( protocol_version ) . await . map_err ( | _ | NegotiationError :: WriteError ) ? ; stream . flush ( ) . await . map_err ( | _ | NegotiationError :: WriteError ) ? ; Result :: < S , NegotiationError > :: Ok ( stream ) }
Write future to send our magic and version to the remote,
returning an error if writes are refused by the stream.
Write future to send our magic and version to the remote returning an error if writes are refused by the stream .
stream
S
protocol_version
u8
stream
S
protocol_version
u8