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 inputs;
26pub use inputs::*;
27
28mod outputs;
29pub use outputs::*;
30
31#[cfg(feature = "std")]
32mod stderr;
33#[cfg(feature = "std")]
34pub use stderr::*;
35
36#[cfg(feature = "std")]
37mod stdin;
38#[cfg(feature = "std")]
39pub use stdin::*;
40
41#[cfg(feature = "std")]
42mod stdout;
43#[cfg(feature = "std")]
44pub use stdout::*;
45
46mod system;
47pub use system::*;