refactor: Favor futures crate over futures-lite to reduce dependencies

This commit is contained in:
Michael Aaron Murphy 2022-03-27 16:54:26 +02:00 committed by Michael Murphy
parent b770b59e7b
commit 4153f9f060
18 changed files with 116 additions and 107 deletions

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: MPL-2.0
use blocking::Unblock;
use futures_lite::{AsyncBufReadExt, AsyncRead, Stream, StreamExt};
use futures::{AsyncBufReadExt, AsyncRead, Stream, StreamExt};
use serde::Deserialize;
use std::io;
@ -22,9 +22,9 @@ where
I: AsyncRead + Unpin + Send,
S: for<'a> Deserialize<'a>,
{
futures_lite::io::BufReader::new(input)
futures::io::BufReader::new(input)
.lines()
.take_while(Result::is_ok)
.take_while(|x| futures::future::ready(x.is_ok()))
.map(Result::unwrap)
.map(|line| serde_json::from_str::<S>(&line))
}