hannobraun / inotify-rs

Idiomatic inotify wrapper for the Rust programming language
ISC License
254 stars 64 forks source link

Using Inotify::read_events in async context #189

Closed DBLouis closed 2 years ago

DBLouis commented 2 years ago

Returning an empty iterator when EGAIN/EWOULDBLOCK is returned by read is not ideal in async context, for example in combination with tokio AsyncFd, because you need to detect "wouldblocks" but for that you have to consume the iterator. The iterator in neither Clone nor ExactSizeIterator which would help. I think that not handling this special case and letting the caller decide what to do with it is better.

hannobraun commented 2 years ago

Hi @DBLouis, thank you for opening this issue!

So you're saying that this code should be removed, in favor of just returning the error? That sounds sensible to me, and I'd be happy to merge a pull request that does that.

DBLouis commented 2 years ago

Thank you

hannobraun commented 2 years ago

Addressed by #190.