Skip to content

Investigate other designs #3

Open
@aesteve

Description

At the moment, the user can subscribe to incoming messages by passing a MessageHandler, a default implementation for static Functions is provided, and the user can implement the trait if (s)he needs to.

It could be a good idea to grasp inspirations from other crates to know how such a pattern is handled. Giving the user an infinite iterator over messages looks (naively) like a possibility, but how do such "infinite, blocking iterators" work?

References:

  1. Streaming iterator
    May be an interesting approach:
while let Some(message) = eb.consumer("some-address") {
    // this is an infinite loop, though :(
}
  1. "Go full async"
    https://github.com/rust-lang/rfcs/blob/master/text/2033-experimental-coroutines.md

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions