You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working without an async runtime it can be a bit awkward to manage the blocking calls of the live readers. I think that the standard library channel Receiver do it really well:
.iter() provides the blocking API, exactly like the current live readers
.try_iter() provides an iterator that is non blocking and ends as soon as there is no more events
And the great thing is that you can use both as needed. As a result, this creates easy constructions to do things like watching just new events:
let _ = receiver.try_iter().last();// flush the events that were sent beforefor ev in receiver.iter(){/* do stuff with new events */}
They also provide the method recv_timeout() which is super helpful.
The text was updated successfully, but these errors were encountered:
Have you looked at the non-live variants of the readers? It allows you to perform reads without blocking and just returns an option. Otherwise I would have to look into this, but that would probably be after 0.5 release.
When working without an async runtime it can be a bit awkward to manage the blocking calls of the live readers. I think that the standard library channel Receiver do it really well:
.iter()
provides the blocking API, exactly like the current live readers.try_iter()
provides an iterator that is non blocking and ends as soon as there is no more eventsAnd the great thing is that you can use both as needed. As a result, this creates easy constructions to do things like watching just new events:
They also provide the method
recv_timeout()
which is super helpful.The text was updated successfully, but these errors were encountered: