Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capnp-futures: Use more fine-grained futures-* deps #527

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion capnp-futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ keywords = ["async"]
[dependencies]
capnp = { version = "0.20.0", path = "../capnp" }

[dependencies.futures]
[dependencies.futures-channel]
version = "0.3.0"
default-features = false
features = ["std"]

[dependencies.futures-util]
version = "0.3.0"
default-features = false
features = ["io", "std"]

[dev-dependencies.futures]
version = "0.3.0"
default-features = false
Expand Down
6 changes: 3 additions & 3 deletions capnp-futures/src/read_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

use futures::future::Future;
use futures::stream::Stream;
use futures::AsyncRead;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};

use capnp::{message, Error};
use futures_util::stream::Stream;
use futures_util::AsyncRead;

async fn read_next_message<R>(
mut reader: R,
Expand Down
3 changes: 1 addition & 2 deletions capnp-futures/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

use capnp::serialize::{OwnedSegments, SegmentLengthsBuilder};
use capnp::{message, Error, OutputSegments, Result};

use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};

/// Asynchronously reads a message from `reader`.
pub async fn read_message<R>(
Expand Down
2 changes: 1 addition & 1 deletion capnp-futures/src/serialize_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use std::task::{Context, Poll};

use capnp::serialize::OwnedSegments;
use capnp::{message, Result};
use futures::{AsyncRead, AsyncWrite};
use futures_util::{AsyncRead, AsyncWrite};

use crate::serialize::AsOutputSegments;

Expand Down
12 changes: 7 additions & 5 deletions capnp-futures/src/write_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

use futures::channel::oneshot;
use futures::future::Future;
use futures::{AsyncWrite, AsyncWriteExt, StreamExt, TryFutureExt};
use std::future::Future;

use futures_channel::oneshot;
use futures_util::{AsyncWrite, AsyncWriteExt, StreamExt, TryFutureExt};

use capnp::Error;

Expand All @@ -33,12 +34,13 @@ where
Message(M, oneshot::Sender<M>),
Done(Result<(), Error>, oneshot::Sender<()>),
}

/// A handle that allows messages to be sent to a write queue.
pub struct Sender<M>
where
M: AsOutputSegments,
{
sender: futures::channel::mpsc::UnboundedSender<Item<M>>,
sender: futures_channel::mpsc::UnboundedSender<Item<M>>,
in_flight: std::sync::Arc<std::sync::atomic::AtomicI32>,
}

Expand All @@ -65,7 +67,7 @@ where
W: AsyncWrite + Unpin,
M: AsOutputSegments,
{
let (tx, mut rx) = futures::channel::mpsc::unbounded::<Item<M>>();
let (tx, mut rx) = futures_channel::mpsc::unbounded::<Item<M>>();

let in_flight = std::sync::Arc::new(std::sync::atomic::AtomicI32::new(0));

Expand Down
Loading