pharos creates a futures Stream of events and let's observers subscribe to any type that implements the Observable trait. There is a Pharos object that you can forward calls to and that will manage observers for you. You can notify observers by using the Sink impl of the Pharos object.
The observable pattern is pretty handy in general, but I think especially for async code that uses the futures library. The futures traits (like Stream, Sink, AsyncRead, ...) have a limited API about what feedback you can give to users. Even more so when users pass them to stream combinators which take ownership of your type.
Making your type observable allows you to give feedback out of band.
What has changed
- The work I did this week, which brought pharos from version 0.2.x to 0.4 has greatly improved the API. Sink is now implemented for Pharos, making it usable from withing
poll_*functions and improving the implementation of what was formerly a
- Observers can now filter events at the source, avoiding any unnecessary processing, and making it convenient to have a future that will resolve when a specific Variant of an enum event type get's broadcast.
- numerous documentation improvements.
See the changelog for all changes.