1 unstable release
0.1.0 | Nov 22, 2021 |
---|
#1268 in Concurrency
4KB
83 lines
stream-channel
byte stream between threads
example
let (mut l, mut r) = StreamChannel::new();
let send = vec![1, 2, 3, 4];
l.write(&send).unwrap();
l.flush().unwrap();
let mut recv = vec![0; 2];
r.read_exact(recv.as_mut()).unwrap();
assert_eq!(recv, vec![1, 2]);
r.read_exact(recv.as_mut()).unwrap();
assert_eq!(recv, vec![3, 4]);