Async Event Streams

Library for publishing events for multiple consumers using asynchromous streams

Usage example

``` use futures::{executor::LocalPool, task::LocalSpawnExt, StreamExt}; use async_events::EventStreams;

let mut pool = LocalPool::new();

let streams = EventStreams::new(); let mut stream = streams.createeventstream();

let sendertask = async move { assert!(streams.count() == 1); streams.sendevent(42, None).await; streams.sendevent(451, None).await; streams.sendevent(1984, None).await; };

let receivertask = async move { let mut values = Vec::new(); while let Some(event) = stream.next().await { values.push(*event.asref()); } // next() returns none when 'streams' is dropped assert!(values == vec![42, 451, 1984]); };

pool.spawner().spawnlocal(sendertask); pool.spawner().spawnlocal(receivertask); pool.run(); ```