async fn write_all_and_close<W>(writer: &mut W, buf: &[u8]) -> Result<()>
where W: AsyncWrite + Unpin,
Expand description

write_all the data to the writer & close the writer if write_all is successful.