All Projects β†’ novacrazy β†’ parallel-event-emitter

novacrazy / parallel-event-emitter

Licence: other
Parallel event emitter built on futures-rs

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to parallel-event-emitter

Bedops
πŸ”¬ BEDOPS: high-performance genomic feature operations
Stars: ✭ 215 (+641.38%)
Mutual labels:  parallel
Pomegranate
Fast, flexible and easy to use probabilistic modelling in Python.
Stars: ✭ 2,789 (+9517.24%)
Mutual labels:  parallel
IPpy
πŸš€ Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Stars: ✭ 54 (+86.21%)
Mutual labels:  parallel
Transducers.jl
Efficient transducers for Julia
Stars: ✭ 226 (+679.31%)
Mutual labels:  parallel
Rls
Reinforcement Learning Algorithms Based on TensorFlow 2.x
Stars: ✭ 239 (+724.14%)
Mutual labels:  parallel
Marathon
Cross-platform test runner written for Android and iOS projects
Stars: ✭ 250 (+762.07%)
Mutual labels:  parallel
Util
A collection of useful utility functions
Stars: ✭ 201 (+593.1%)
Mutual labels:  parallel
snmpman
Easy massive SNMP-agent simulation with the use of simple YAML files
Stars: ✭ 28 (-3.45%)
Mutual labels:  parallel
Qawolf
🐺 Create browser tests 10x faster
Stars: ✭ 2,912 (+9941.38%)
Mutual labels:  parallel
python-api
Trading API for Quedex Bitcoin Derivatives Exchange.
Stars: ✭ 20 (-31.03%)
Mutual labels:  futures
Deepgraph
Analyze Data with Pandas-based Networks. Documentation:
Stars: ✭ 232 (+700%)
Mutual labels:  parallel
Js
turbo.js - perform massive parallel computations in your browser with GPGPU.
Stars: ✭ 2,591 (+8834.48%)
Mutual labels:  parallel
Ray
An open source framework that provides a simple, universal API for building distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.
Stars: ✭ 18,547 (+63855.17%)
Mutual labels:  parallel
Loadjs
A tiny async loader / dependency manager for modern browsers (899 bytes)
Stars: ✭ 2,507 (+8544.83%)
Mutual labels:  parallel
ips2ra
In-place Parallel Super Scalar Radix Sort (IPSΒ²Ra)
Stars: ✭ 22 (-24.14%)
Mutual labels:  parallel
Taskr
A fast, concurrency-focused task automation tool.
Stars: ✭ 2,421 (+8248.28%)
Mutual labels:  parallel
Hss
An interactive parallel ssh client featuring autocomplete and asynchronous execution.
Stars: ✭ 248 (+755.17%)
Mutual labels:  parallel
hp2p
Heavy Peer To Peer: a MPI based benchmark for network diagnostic
Stars: ✭ 17 (-41.38%)
Mutual labels:  parallel
MatlabProgressBar
This MATLAB class provides a smart progress bar like tqdm in the command window and is optimized for progress information in simple iterations or large frameworks with full support of parallel parfor loops provided by the MATLAB Parallel Computing Toolbox.
Stars: ✭ 44 (+51.72%)
Mutual labels:  parallel
micro-typed-events
The smallest, most convenient typesafe TS event emitter you'll ever need
Stars: ✭ 39 (+34.48%)
Mutual labels:  event-emitter

Parallel Event Emitter

Implementation of an event emitter that invokes event listener callbacks concurrently in a configurable thread pool, using Futures to notify callers of success or errors.

Because all values must be transferred across thread boundaries, all types T must be Send.

Additionally, all types T must be Any, so T: 'static.

Usage

[dependencies]
futures = "0.1"
parallel-event-emitter = "0.2.4"

Example using a String as the key:

extern crate futures;
extern crate parallel_event_emitter;

use futures::Future;
use parallel_event_emitter::*;

fn main() {
    let mut emitter: ParallelEventEmitter<String> = ParallelEventEmitter::new();

    emitter.add_listener("some event", || {
        println!("Hello, World!");

        Ok(())
    }).unwrap();

    assert_eq!(1, emitter.emit("some event").wait().unwrap());
}

Or using a custom event type:

extern crate futures;
extern crate parallel_event_emitter;

use futures::Future;
use parallel_event_emitter::*;

#[derive(Debug, Hash, PartialEq, Eq, Clone)]
enum MyEvents {
    EventA,
    EventB,
}

fn main() {
    let mut emitter: ParallelEventEmitter<MyEvents> = ParallelEventEmitter::new();

    emitter.add_listener(MyEvents::EventA, || {
        println!("Hello, World!");

        Ok(())
    }).unwrap();

    assert_eq!(1, emitter.emit(MyEvents::EventA).wait().unwrap());
}

Trace<E> type

This crate depends on the trace-error crate to have simple and lightweight backtraces on all error Results.

If you choose not to use that, which is fine by me, simply call .into_error() on all Trace<E> values to get the real error.

impl Trait feature

Instead of having all the emit* methods returning a boxed Future (BoxFuture), the Cargo feature conservative_impl_trait can be given to enable impl Future return types on all the emit* methods.

[dependencies.parallel-event-emitter]
version = "0.2.4"
features = ["default", "conservative_impl_trait"] # And maybe integer_atomics

Larger ListenerIds

Although the ListenerId type itself is u64, the atomic counter underneath is restricted to AtomicUsize by default.

To enable true guaranteed 64-bit counters, use the integer_atomics feature for the crate.

[dependencies.parallel-event-emitter]
version = "0.2.4"
features = ["default", "integer_atomics"] # And maybe conservative_impl_trait
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].