This commit adds tests to CI that tests new patches for event-listener
with dependent crates. Examples of these dependent crates are:
- event-listener-strategy
- async-channel
- async-lock
Signed-off-by: John Nunley <dev@notgull.net>
This commit makes the panic message for a listener that's not inserted
into the linked list much clearer. The goal is to convey to the user
that they may be `poll`ing the listener after it has completed.
This commit also fixes some new Clippy lints.
cc #124
Signed-off-by: John Nunley <dev@notgull.net>
* Make sure Unpin is implemented for StackListener
* Purge the prelude
* Remove unused imports from doctests
Signed-off-by: John Nunley <dev@notgull.net>
Minimal amount of changes to make EventListener a heap-allocated type
again. The existence of the EventListener implies that it is already
listening; accordingly the new() and listen() methods on EventListener
have been removed.
cc #104
Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite
existing listeners if they already exist. If the listener is already
registered in an event listener list, it removes the listener from that
list before registering the new listener. This soundness bug was missed
during #94.
This is a patch-compatible fix for #100. We may also want an API-level
fix for #100 as well. This is up for further discussion.
Signed-off-by: John Nunley <dev@notgull.net>
This is a breaking change. It makes `new()` take no parameters in its
signature and `listen()` take a reference to an event in its signature.
This should avoid a footgun where a listener can be waited on without
listening on it.
Closes#91
Signed-off-by: John Nunley <dev@notgull.net>
In retrospect it is sometimes unclear in the documentation that the new event
listener needs to be pinned and inserted into the list before it can receive
events. This PR adds documentation that should clarify this issue.
Closes#89
Signed-off-by: John Nunley <dev@notgull.net>
This commit adds WASM compilation support to this crate. The main thing
is that the wait() family of APIs are removed in WASM mode, as blocking
is not allowed in WASM.
In addition, tests are added to CI to support WASM.
Signed-off-by: John Nunley <dev@notgull.net>
There was a deadlock where notifications would not get delivered for
listeners that were stuck in the fallback queue. There is an
optimization where the notification count is checked to see if the
notifications delivered by the user would make any impact on the
listener chain; if it wouldn't, then it isn't done at all. For no_std,
I've removed this optimization, as I doubt that it can be done
consistently due to the nature of the fallback queue.
During testing I also uncovered problems with the current implementation
of the fallback queue itself. I've replaced it with concurrent-queue for
now, as I doubt that a fully functioning queue wouldn't be trivial
enough to justify inlining it into event-listener itself. Unfortunately
it adds three additional dependencies to the tree of event-listener.
With this change, the async-channel tests pass consistently.
Signed-off-by: John Nunley <dev@notgull.net>