So I have this code:
It polls stdin
and only yields item if there were more than 5 bytes.
If I return Ok(NotReady)
from my poll
method everything stops working.
My stream's poll
will not be called anymore.
What am I missing?
So I have this code:
It polls stdin
and only yields item if there were more than 5 bytes.
If I return Ok(NotReady)
from my poll
method everything stops working.
My stream's poll
will not be called anymore.
What am I missing?
I think you need to somehow schedule your future to be woken up once more data is available. But I don't know how that is done in the tokio_fs API.
You have to loop until poll_read()
returns NotReady
; when it does, it’ll register itself for a notification when it has more data to read.
Yes, loop
fixed it. Thanks!