1use crate::bytes::AsBytes;
2use futures_io::AsyncWrite;
3use futures_util::AsyncWriteExt;
4
5pub async fn send<S, M>(stream: &mut S, msg: M) -> Result<(), futures_io::Error>
6where
7 S: AsyncWrite + Unpin,
8 M: AsBytes,
9{
10 stream.write_all(msg.as_bytes()).await?;
11 stream.flush().await
12}