Expand description
Allows creating unis, which represent pairs of (producer, event pipeline) that may be used to
produce() asynchronous payloads to be processed by a single event pipeline Stream – and executed
by one or more async tasks.
Usage:
fn on_event(stream: impl Stream<Item=String>) -> impl Stream<Item=String> {
stream
.inspect(|message| println!("To Zeta: '{}'", message))
.inspect(|sneak_peeked_message| println!("EARTH: Sneak peeked a message to Zeta Reticuli: '{}'", sneak_peeked_message))
.inspect(|message| println!("ZETA: Received a message: '{}'", message))
}
let uni = UniBuilder::new()
.on_stream_close(|_| async {})
.spawn_non_futures_non_fallible_executor("doc_test() Event", on_event);
let producer = uni.producer_closure();
producer("I've just arrived!".to_string()).await;
producer("Nothing really interesting here... heading back home!".to_string()).await;
uni.close().await;Modules§
- channels
- Provides channels to be used in Unis
Macros§
- unis_
close_ async - Macro to close, atomically-ish, all Unis passed as parameters
Structs§
- Uni
- Contains the producer-side Uni handle used to interact with the
unievent – for closing the stream, requiring stats, …
Traits§
- Generic
Uni - This trait exists to allow simplifying generic declarations of concrete Uni types.
See also [GenericMulti].
Usage: