Skip to content

Commit

Permalink
Trim unnecessary dependencies, prepare 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebind committed Jul 23, 2019
1 parent ef52365 commit 9ab0c42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sluice"
version = "0.4.0"
version = "0.4.1"
authors = ["Stephen M. Coakley <[email protected]>"]
edition = "2018"
description = "Efficient ring buffer for byte buffers, FIFO queues, and SPSC channels"
Expand All @@ -15,10 +15,13 @@ license = "MIT"
nightly = []

[dependencies]
futures-preview = "0.3.0-alpha.17"
futures-channel-preview = "0.3.0-alpha.17"
futures-core-preview = "0.3.0-alpha.17"
futures-io-preview = "0.3.0-alpha.17"

[dev-dependencies]
criterion = "0.2"
futures-preview = "0.3.0-alpha.17"

[[bench]]
name = "pipe"
Expand Down
15 changes: 9 additions & 6 deletions src/pipe/chunked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
//! that happen during reads and writes are occasional reallocation for each
//! individual vector to fit larger chunks of bytes that don't already fit.
use futures::channel::mpsc;
use futures::prelude::*;
use futures::task::*;
use futures_channel::mpsc;
use futures_core::Stream;
use futures_io::{AsyncRead, AsyncWrite};
use std::io::{self, Cursor};
use std::pin::Pin;
use std::task::{Context, Poll};

/// Create a new chunked pipe with room for a fixed number of chunks.
///
Expand Down Expand Up @@ -79,7 +80,7 @@ impl AsyncRead for Reader {
let mut chunk = match self.chunk.take() {
Some(chunk) => chunk,

None => match self.buf_stream_rx.poll_next_unpin(cx) {
None => match Pin::new(&mut self.buf_stream_rx).poll_next(cx) {
// Wait for a new chunk to be delivered.
Poll::Pending => return Poll::Pending,

Expand Down Expand Up @@ -156,7 +157,7 @@ impl AsyncWrite for Writer {
}

// Attempt to grab an available buffer to write the chunk to.
match self.buf_pool_rx.poll_next_unpin(cx) {
match Pin::new(&mut self.buf_pool_rx).poll_next(cx) {
// Wait for the reader to finish reading a chunk.
Poll::Pending => Poll::Pending,

Expand Down Expand Up @@ -197,6 +198,8 @@ impl AsyncWrite for Writer {
#[cfg(all(test, feature = "nightly"))]
mod tests {
use futures::executor::block_on;
use futures::prelude::*;
use futures::task::noop_waker;
use super::*;

#[test]
Expand Down Expand Up @@ -234,7 +237,7 @@ mod tests {
let waker = noop_waker();
let mut context = Context::from_waker(&waker);

let (mut reader, mut writer) = new(2);
let (reader, mut writer) = new(2);

drop(reader);

Expand Down
4 changes: 2 additions & 2 deletions src/pipe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
//! Pipes are like byte-oriented channels that implement I/O traits for reading
//! and writing.
use futures::prelude::*;
use futures_io::{AsyncRead, AsyncWrite};
use std::fmt;
use std::io;
use std::pin::Pin;
use std::task::*;
use std::task::{Context, Poll};

mod chunked;

Expand Down

0 comments on commit 9ab0c42

Please sign in to comment.