pub async fn write_all(stream: &mut TcpStream, buf: &[u8]) -> Result<()>
Writes all bytes to a stream, looping until the entire buffer is consumed.