rust-bakery / nom-bufreader

BufReader adapter for nom parsers
MIT License
9 stars 5 forks source link

Bug fix: Implementing futures_io::AsyncBufRead is not straightforward. #12

Open cheako opened 2 years ago

cheako commented 2 years ago

This contains the other two PRs.

I can't find the function that did this, but it was something like if Ready is returned and then Pending immediately leads to panic. As such, if there is any data in a BufReader poll_fill_buf can not, by circular logic, read more async data... Because it can not call read and then return Pending, so it would be a blocking read call.

As such, there is no way to implement a nom wrapper AND a BufReader, because nom may need more data even if there is some data and this violates the conditions of implementing a BufReader.

cheako commented 2 years ago

Looking at it, it could probably be done better... I'm just tied down with other things.

cheako commented 2 years ago

Fixes: https://github.com/rust-bakery/nom-bufreader/issues/10