sugars_async_stream/
lib.rs

1//! Asynchronous programming utilities
2//!
3//! Choose your runtime and get both AsyncTask and AsyncStream plus convenient macros:
4//! - `tokio-async`: Full Tokio ecosystem with mpsc channels
5//! - `std-async`: Runtime-agnostic using async-channel  
6//! - `crossbeam-async`: Compute-heavy workloads with crossbeam + async-channel
7
8pub mod emitter_builder;
9pub mod result_types;
10pub mod stream;
11pub mod stream_ext;
12
13// Runtime-specific unified exports
14#[cfg(all(
15    feature = "crossbeam-backend",
16    not(feature = "tokio-backend"),
17    not(feature = "std-backend")
18))]
19pub use stream::crossbeam::AsyncStream;
20#[cfg(all(feature = "std-backend", not(feature = "tokio-backend")))]
21pub use stream::std::AsyncStream;
22#[cfg(feature = "tokio-backend")]
23pub use stream::tokio::AsyncStream;
24
25// Core types available in all configurations
26pub use emitter_builder::{EmitterBuilder, EmitterImpl};
27pub use result_types::{AsyncResult, AsyncResultChunk};
28pub use stream_ext::StreamExt;
29
30// Re-export from async_task
31pub use sugars_async_task::{AsyncTask, NotResult};
32
33/// Pipe operator for fluent chaining of operations
34#[macro_export]
35macro_rules! pipe {
36    ($value:expr => $func:expr) => {
37        $func($value)
38    };
39    ($value:expr => $func:expr => $($rest:tt)*) => {
40        pipe!($func($value) => $($rest)*)
41    };
42}