by lor_louis · 4y ago · 0 comments
https://doc.rust-lang.org/src/std/sys/unix/fd.rs.html#77
https://doc.rust-lang.org/src/std/sys/unix/fd.rs.html#144
Buf(Reader|Writer) are vectored I/O aware, bypassing the internal buffer whenever the total length of the provided buffers is larger:
https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.h...
https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.h...
It might be interesting to have a version of a Writer trait that handed ownership over in addition to supporting slices and handled things under the hood for you. The API may be too complex to bother with. Buffered I/O is typically a fine middle ground. When you start needing writev you’re changing the I/O model more drastically.