ssb-handshake 0.5.1

Secret-handshake protocol for Secure Scuttlebutt
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::bytes::AsBytes;
use futures_io::AsyncWrite;
use futures_util::AsyncWriteExt;

pub async fn send<S, M>(stream: &mut S, msg: M) -> Result<(), futures_io::Error>
where
    S: AsyncWrite + Unpin,
    M: AsBytes,
{
    stream.write_all(msg.as_bytes()).await?;
    stream.flush().await
}