martin-g commented on pull request #1379:
URL: https://github.com/apache/avro/pull/1379#issuecomment-951563363


   You understood it correctly! With `Read` you consumed the bytes on the first 
read. On the second attempt it returns EOF and thus the `None`.
   
   https://doc.rust-lang.org/std/io/trait.Read.html#impl-Read-2 says 
   ```
   Read is implemented for &[u8] by copying from the slice.
   
   Note that reading updates the slice to point to the yet unread part. The 
slice will be empty when EOF is reached.
   ```
   
   If you want to `read` the same data twice you need to `reset` the source. 
This is what the `Seek` trait gives you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to