Skip to main content

Crate lazyflow_io

Crate lazyflow_io 

Source
Expand description

I/O constructors for lazyflow โ€“ ergonomic sources and sinks for files, TCP, and UDP.

โ“˜
use lazyflow_io::net;

net::tcp_server("0.0.0.0:8080".parse()?)
    .map(|conn| {
        let (lines, writer) = conn.into_lines();
        lines.eval_map(move |line| {
            let writer = writer.clone();
            async move {
                writer.write_all(b"hello\n").await?;
                Ok(line)
            }
        })
    })
    .par_join_unbounded()
    .for_each(|msg| println!("{msg}"))
    .await?;

Modulesยง

file
File I/O constructors.
net
TCP and UDP constructors.