Creates a future that will write the entire contents of the buffer
The returned future will not return until all the data has been written, and the future will resolve to the stream as well as the buffer (for reuse if needed).
Any error which happens during writing will cause both the stream and the buffer to get destroyed.
buf parameter here only requires the
AsRef<[u8]> trait, which should
be broadly applicable to accepting data which can be converted to a slice.
Window struct is also available in this crate to provide a different
window into a slice if necessary.