Skip to content

Commit ec07245

Browse files
committed
RUST-765 Depend on futures subcrates instead of futures (C-STABLE)
1 parent 0701a67 commit ec07245

File tree

14 files changed

+27
-20
lines changed

14 files changed

+27
-20
lines changed

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ bitflags = "1.1.0"
3737
bson = { git = "https://github.com/mongodb/bson-rust" }
3838
chrono = "0.4.7"
3939
derivative = "2.1.1"
40-
futures = "0.3.5"
40+
futures-core = "0.3.14"
41+
futures-io = "0.3.14"
42+
futures-util = { version = "0.3.14", features = ["io"] }
43+
futures-executor = "0.3.14"
4144
hex = "0.4.0"
4245
hmac = "0.10.1"
4346
lazy_static = "1.4.0"
@@ -110,6 +113,7 @@ features = ["v4"]
110113
approx = "0.4.0"
111114
derive_more = "0.99.13"
112115
function_name = "0.2.0"
116+
futures = "0.3"
113117
pretty_assertions = "0.7.1"
114118
serde_json = "1.0.64"
115119
semver = "0.11.0"

src/bson_util/async_encoding.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
1+
use futures_io::{AsyncRead, AsyncWrite};
2+
use futures_util::{AsyncReadExt, AsyncWriteExt};
23

34
use crate::{
45
bson::Document,

src/cmap/conn/wire/message.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bitflags::bitflags;
2-
use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
2+
use futures_io::{AsyncRead, AsyncWrite};
3+
use futures_util::{AsyncReadExt, AsyncWriteExt};
34

45
use super::{
56
header::{Header, OpCode},

src/cmap/conn/wire/util.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::{
44
task::{Context, Poll},
55
};
66

7-
use futures::io::{self, AsyncRead, AsyncWrite, AsyncWriteExt};
7+
use futures_io::{self, AsyncRead, AsyncWrite};
8+
use futures_util::AsyncWriteExt;
89
use lazy_static::lazy_static;
910

1011
use crate::error::Result;
@@ -32,7 +33,7 @@ pub(super) async fn write_cstring<W: AsyncWrite + Unpin>(
3233
Ok(())
3334
}
3435

35-
/// A wrapper around `futures::io::AsyncRead` that keeps track of the number of bytes it has read.
36+
/// A wrapper around `futures_io::AsyncRead` that keeps track of the number of bytes it has read.
3637
pub(super) struct CountReader<'a, R: AsyncRead + Unpin + Send + 'a> {
3738
reader: &'a mut R,
3839
bytes_read: usize,
@@ -58,7 +59,7 @@ impl<'a, R: AsyncRead + Unpin + Send + 'a> AsyncRead for CountReader<'a, R> {
5859
mut self: Pin<&mut Self>,
5960
cx: &mut Context,
6061
buf: &mut [u8],
61-
) -> Poll<io::Result<usize>> {
62+
) -> Poll<futures_io::Result<usize>> {
6263
let result = Pin::new(&mut self.reader).poll_read(cx, buf);
6364

6465
if let Poll::Ready(Ok(count)) = result {

src/coll/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod options;
33

44
use std::{borrow::Borrow, fmt, fmt::Debug, sync::Arc};
55

6-
use futures::StreamExt;
6+
use futures_util::stream::StreamExt;
77
use serde::{
88
de::{DeserializeOwned, Error},
99
Deserialize,

src/cursor/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
};
77

88
use derivative::Derivative;
9-
use futures::{Future, Stream};
9+
use futures_core::{Future, Stream};
1010

1111
use crate::{
1212
bson::Document,

src/cursor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
task::{Context, Poll},
77
};
88

9-
use futures::{future::BoxFuture, Stream};
9+
use futures_core::{future::BoxFuture, Stream};
1010
use serde::de::DeserializeOwned;
1111

1212
use crate::{

src/cursor/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
task::{Context, Poll},
55
};
66

7-
use futures::{future::BoxFuture, Stream};
7+
use futures_core::{future::BoxFuture, Stream};
88
use serde::de::DeserializeOwned;
99

1010
use super::common::{CursorInformation, GenericCursor, GetMoreProvider, GetMoreProviderResult};

src/db/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod options;
22

33
use std::{fmt::Debug, sync::Arc};
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use serde::{de::DeserializeOwned, Serialize};
77

88
use crate::{
@@ -235,8 +235,8 @@ impl Database {
235235
) -> Result<Vec<String>> {
236236
cursor
237237
.and_then(|doc| match doc.get("name").and_then(Bson::as_str) {
238-
Some(name) => futures::future::ok(name.into()),
239-
None => futures::future::err(
238+
Some(name) => futures_util::future::ok(name.into()),
239+
None => futures_util::future::err(
240240
ErrorKind::InvalidResponse {
241241
message: "Expected name field in server response, but there was none."
242242
.to_string(),

src/runtime/async_read_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use async_trait::async_trait;
2-
use futures::io::AsyncRead;
2+
use futures_io::AsyncRead;
33

44
use crate::error::Result;
55

66
/// Trait providing helpers that read various integer types in little-endian order.
77
#[async_trait]
8-
pub(crate) trait AsyncLittleEndianRead: Unpin + futures::io::AsyncReadExt {
8+
pub(crate) trait AsyncLittleEndianRead: Unpin + futures_util::AsyncReadExt {
99
/// Read an `i32` in little-endian order.
1010
async fn read_i32(&mut self) -> Result<i32> {
1111
let mut buf: [u8; 4] = [0; 4];

0 commit comments

Comments
 (0)