//! Buffer between `read()` calls
use std::{
- io::{self, ErrorKind, Read},
- sync::{mpsc::Receiver, Arc, Mutex},
+ io::{self, Read},
+ sync::{Arc, Mutex, mpsc::Receiver},
};
#[derive(Clone)]
let output = {
let rx = self.rx.lock().unwrap();
rx.recv()
- .map_err(|s| io::Error::new(ErrorKind::Other, format!("{:?}", s)))?
+ .map_err(|s| io::Error::other(format!("{:?}", s)))?
};
let to_write = output.len().min(buf.len());
buf[0..to_write].copy_from_slice(&output[0..to_write]);