Crates.io | stream-channel |
lib.rs | stream-channel |
version | 0.1.0 |
source | src |
created_at | 2021-11-22 02:08:27.807049 |
updated_at | 2021-11-22 02:08:27.807049 |
description | stream in channel |
homepage | |
repository | https://github.com/gipsyh/stream-channel |
max_upload_size | |
id | 485516 |
size | 4,000 |
byte stream between threads
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]);