Skip to content

Commit 5dd4375

Browse files
authored
Merge pull request #688 from paolobarbolini/lighter-futures-util
Lighten `futures` dependency
2 parents 4218082 + 7479405 commit 5dd4375

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ pin-project-lite = { version = "0.2.16", optional = true }
2727
reqwest = { version = "0.12.22", optional = true, default-features = false, features = ["rustls-tls", "http2", "stream"] }
2828
bytes = { version = "1.10.1", optional = true }
2929
uuid = { version = "1.17.0", features = ["v4"] }
30+
futures-core = "0.3.31"
3031
futures-io = "0.3.31"
31-
futures = "0.3.31"
32+
futures-channel = "0.3.31"
33+
futures-util = { version = "0.3.31", default-features = false, features = ["io"] }
3234

3335
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
3436
jsonwebtoken = { version = "9.3.1", default-features = false }

src/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub trait HttpClient: Clone + Send + Sync {
7979
Body: Serialize + Send + Sync,
8080
Output: DeserializeOwned + 'static + Send,
8181
{
82-
use futures::io::Cursor;
82+
use futures_util::io::Cursor;
8383

8484
self.stream_request(
8585
url,

src/reqwest.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use std::{
55

66
use async_trait::async_trait;
77
use bytes::{Bytes, BytesMut};
8-
use futures::{AsyncRead, Stream};
8+
use futures_core::Stream;
9+
use futures_io::AsyncRead;
910
use pin_project_lite::pin_project;
1011
use serde::{de::DeserializeOwned, Serialize};
1112

@@ -90,10 +91,10 @@ impl HttpClient for ReqwestClient {
9091
}
9192
#[cfg(target_arch = "wasm32")]
9293
{
93-
use futures::{pin_mut, AsyncReadExt};
94+
use futures_util::AsyncReadExt;
9495

9596
let mut buf = Vec::new();
96-
pin_mut!(body);
97+
let mut body = std::pin::pin!(body);
9798
body.read_to_end(&mut buf)
9899
.await
99100
.map_err(|err| Error::Other(Box::new(err)))?;

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::time::Duration;
22

33
#[cfg(not(target_arch = "wasm32"))]
44
pub(crate) async fn async_sleep(interval: Duration) {
5-
let (sender, receiver) = futures::channel::oneshot::channel::<()>();
5+
let (sender, receiver) = futures_channel::oneshot::channel::<()>();
66
std::thread::spawn(move || {
77
std::thread::sleep(interval);
88
let _ = sender.send(());

0 commit comments

Comments
 (0)