async_flow/tokio/
mod.rs

1// This is free and unencumbered software released into the public domain.
2
3use alloc::boxed::Box;
4
5pub fn bounded<T>(buffer: usize) -> (Outputs<T>, Inputs<T>) {
6    let (tx, rx) = tokio::sync::mpsc::channel(buffer);
7    let outputs = Outputs::from(tx);
8    let inputs = Inputs::from(rx);
9    (outputs, inputs)
10}
11
12pub fn bounded_boxed<T>(
13    buffer: usize,
14) -> (
15    Box<dyn crate::io::OutputPort<T> + Send>,
16    Box<dyn crate::io::InputPort<T> + Send>,
17)
18where
19    T: Send + Sync + 'static,
20{
21    let (outputs, inputs) = bounded(buffer);
22    (Box::new(outputs), Box::new(inputs))
23}
24
25mod input;
26pub use input::*;
27
28mod inputs;
29pub use inputs::*;
30
31mod output;
32pub use output::*;
33
34mod outputs;
35pub use outputs::*;
36
37#[cfg(feature = "std")]
38mod stderr;
39#[cfg(feature = "std")]
40pub use stderr::*;
41
42#[cfg(feature = "std")]
43mod stdin;
44#[cfg(feature = "std")]
45pub use stdin::*;
46
47#[cfg(feature = "std")]
48mod stdout;
49#[cfg(feature = "std")]
50pub use stdout::*;
51
52mod system;
53pub use system::*;