embedded_io::Read specifies that reading into an empty buffer does not block.
If buf.len() == 0, read returns without blocking, with either Ok(0) or an error. The Ok(0) doesn’t indicate EOF, unlike when called with a non-empty buffer.
We implemented read in terms of the semantics of BufRead which blocks if there are no bytes available. This is incorrect in that we need to check if we actually have to wait for any bytes to be loaded.
embedded_io::Read
specifies that reading into an empty buffer does not block.We implemented
read
in terms of the semantics ofBufRead
which blocks if there are no bytes available. This is incorrect in that we need to check if we actually have to wait for any bytes to be loaded.