readByte

public func readByte[R](mutating R) -> Result[Optional[UInt8], IoError] where R: Readable, R: not Copyable

Reads exactly one byte. Returns .Ok(.None) on EOF, .Ok(.Some(b)) on success, or propagates a reader error.

Examples

match try readByte(reader) { .Some(b) => use(b), .None => /* EOF */ break }

Defined in lang/std/io/read.ks