Covering up all the changes!
This update adds an async dispatcher, a new approach to how dispatchers are
feature-gated, and dispatchers no longer expect the listeners to be wrapped in
example Arc<RwLock<Listener>>
.
First, a tokio async dispatcher has been added.
It requires the async
-feature.
Besides the async
-feature, blocking dispatchers are now inside blocking
,
those don't support multithreading, they keep Rc
s to the listener.
There is also the rayon
-based parallel
-feature, it utilises a threadpool
for dispatching. Originally this was called sync
-module. The normal dispatcher
has been removed from this module as it has no purpose.
Dispatchers take the type implementing the trait by value, this means you can provide a weak reference, strong reference, or value. Before dispatchers secretly acquired a weak reference to the provided reference counter.
- Renamed dispatcher requests to
DispatchResult
. - Introduced features and replaced modules by:
blocking
,parallel
,async
blocking
: pulls in single-threaded dispatchers,parallel
pulls inrayon
for threadpooled dispatchers,async
pulls inasync-trait
andtokio
for async dispatchers,
- Removed
failure
. - Removed
Rc
basedPriorityDispatcher
.
- Added async dispatcher.
Just a parking_lot
-dependency update to 0.8
.
parking_lot
updated to0.8
.
This release updates the parking_lot
-dependency to 0.7
and while we are at
it: From now on, hey_listen
will use RwLock
for the listeners instead of
Mutex
.
On another note, the term EventDispatcher
has been simplified
to just Dispatcher
as every dispatcher in this library dispatches events.
Also, the re-exports added in 0.2.1
, which warranted stability,
have been removed.\
Last and probably least important: The source code has been updated to
Rust 2018. Somewhat related to that, the new required Rust version is 1.34.1
.
- All
add_listener
-methods expect a listener wrapped inside aparking_lot::RwLock
instead of aparking_lot::Mutex
. parking_lot
updated to0.7
.- Re-exports introduced in
0.2.1
have been removed. - New required Rust version:
1.34.1
.
This release adds std::rc::Rc
-alternatives for dispatchers that do not require to be Send
and Sync
.
Furthermore, hey_listen
is now refactored into two modules:
rc
: dispatchers usingstd::rc::Rc
.sync
: dispatchers usingstd::sync::Arc
.
Nonetheless, we re-import everything into the crate's root securing stability.
Optionally, consider updating imports:
hey_listen::sync::Dispatcher
instead ofhey_listen::Dispatcher
.hey_listen::sync::PriorityDispatcher
instead ofhey_listen::PriorityDispatcher
.hey_listen::sync:ParallelDispatcher
instead ofhey_listen::ParallelDispatcher
.hey_listen::sync::ParallelListener
instead ofhey_listen::ParallelListener
.
hey_listen::rc::Dispatcher
to useRc
instead ofArc
.hey_listen::rc::PriorityDispatcher
to useRc
instead ofArc
.sync
andrc
modules.parking_lot::Mutex
is now re-imported and can be accessed viahey_listen::Mutex
.
This release adds a parallel dispatcher and allows listeners to return requests back to their dispatcher. These requests have following effects: Stopping the event propagation, unsubscribing from further dispatch, and combining both concepts. Nonetheless, requests to parallel dispatchers are limited to unsubscribing.
ParallelEventDispatcher
has been added.SyncDispatchResult
to return instructions from listeners back to dispatcher.ParallelDispatchResult
to return instructions from listeners back to parallel dispatcher.- Examples have been added.
- Synchronous dispatchers return
Option<SyncDispatchResult>
.
This release supports callbacking closures and ordering dispatching via priority-levels.