Crate framed_pipe

Source
Expand description

§Framed Pipe

MPSC-based Pipe to read/write frames, somewhat like a message box over bytes

§Example

    let (tx, mut rx) = framed_pipe(n * 2, 4);

    let echo_data = vec![vec![0xFF; n], vec![1, 2], vec![], vec![0x0; n / 2]];
    for _ in 0..100 {
        for data in echo_data.iter() {
            tx.clone().try_send(data).expect("send");
        }
        for data in echo_data.iter() {
            let rx_data = rx.next().await.unwrap().expect("rx");
            assert_eq!(&rx_data, data.as_slice());
        }
    }

Structs§

FramedPipeReceiver
Receiver end for the FramedPipe, there’s at most one reader
FramedPipeSender
A sender for the FramedPipe can be cloned and used a Sink

Enums§

FramedPipeError

Functions§

framed_pipe
Creates a framed pipe buf_cap describes the maximum capacity in bytes for the buffer frame_cap describes the maximum capacity in terms of frames