readExact
public func readExact[R](mutating R, into: ArraySlice[UInt8]) -> Result[(), IoError] where R: Readable, R: not CopyableReads exactly buf.count bytes; treats a short read (EOF reached
early) as an error rather than a quiet truncation. Use when the
caller wants binary fidelity — e.g. reading a fixed-width header.
Errors
Returns .Err(invalidInput()) if EOF is reached before buf.count
bytes have been collected.
Examples
var header = Array[UInt8](repeating: 0, count: 16);
try readExact(file, into: header.asSlice()); // must read 16 bytesDefined in lang/std/io/read.ks