silence some warnings about unchecked Result/Err

alternatively I should find a way to propagate the errors back to the
writter
This commit is contained in:
Дамјан Георгиевски 2020-09-20 01:41:00 +02:00
parent d33810da52
commit 375d8aa62b

View file

@ -40,17 +40,17 @@ impl StreamWriter {
impl io::Write for StreamWriter {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
let len = data.len();
futures::executor::block_on(
async move {
let buf = bytes::Bytes::copy_from_slice(data);
self.tx.send(buf).await;
}
);
futures::executor::block_on(async move {
let buf = bytes::Bytes::copy_from_slice(data);
self.tx.send(buf).await.ok(); // maybe propagate any errors back
});
Ok(len)
}
fn flush(&mut self) -> io::Result<()> {
futures::executor::block_on(self.tx.flush());
futures::executor::block_on(async move {
self.tx.flush().await.ok()
});
Ok(())
}
}