std-method
Write::write_all: complete write
Repeat writes until all supplied bytes have been accepted or an error occurs. A zero-progress write with bytes remaining becomes WriteZero. A failed call may already have written a prefix. Expected stdout (not executed): true [97, 98] Common mistake: Retrying the entire payload after a partial failure without a protocol for recovery.
Formal Syntax & Structure
rust syntaxrust
writer.write_all(&[u8]) -> io::Result<()>Working Example
Example Snippetrust
fn main() { use std::io::Write; let mut storage = [0u8; 2]; let mut dest = &mut storage[..]; let err = dest.write_all(b"abc").unwrap_err(); println!("{} {:?}", err.kind() == std::io::ErrorKind::WriteZero, storage);}