2 Checks for unused written/read amount.
5 `io::Write::write(_vectored)` and
6 `io::Read::read(_vectored)` are not guaranteed to
7 process the entire buffer. They return how many bytes were processed, which
9 than a given buffer's length. If you don't need to deal with
10 partial-write/read, use
11 `write_all`/`read_exact` instead.
13 When working with asynchronous code (either with the `futures`
14 crate or with `tokio`), a similar issue exists for
15 `AsyncWriteExt::write()` and `AsyncReadExt::read()` : these
16 functions are also not guaranteed to process the entire
17 buffer. Your code should either handle partial-writes/reads, or
18 call the `write_all`/`read_exact` methods on those traits instead.
21 Detects only common patterns.
26 fn foo<W: io::Write>(w: &mut W) -> io::Result<()> {
27 // must be `w.write_all(b"foo")?;`