Add `is_at_eof()` to `BufRead` trait

Continuously deserializing objects from a reader.

while !file.is_at_eof()? {
    let obj = rmp_serde::decode::from_read(&mut file)?;
    // rest of the loop
}

If I don't check for EOF then I get a deserialization error, and with some serde libs it's hard to tell whether that error is caused by EOF or something else.

1 Like