[][src]Crate concurrent_event

This crate implements an event which executes registered event handlers concurrently. Additionally, each handler is assigned an ID with which it can be referenced after creation. This allows for associated state for each event handler.

The system was setup to be resistant to adversarial code. In particular, IDs are assigned randomly with sufficiently many bits to be unfeasable to guess. As a consequence, efficiency may suffer. Particularly the IDs are larger than they would need to be if assigned sequentially.

Important Note

We provide no guarantees as the security properties were not rigorously verified. Do not use in critical systems without further investigation!


This is a simple usage scenarion with a custom event handler.

use concurrent_event::Event;
use concurrent_event::handler::EventHandler; 

struct Printer;

impl EventHandler<&str> for Printer {
    fn on_event(&mut self, arg: &str) {
        print!("{}", arg);

let mut event = Event::<&str, Printer>::new();
event.emit("Hello, World!");

In the handler package, default implementation for stateless and stateful event handlers can be found, which take a closure at construction.



Contains the definition of the event handler trait as well as some standard implementations for common use cases.


Contains the definition of the handler ID which is used for referencing event handlers after registration.



An event manages multiple handlers which can be registered.