Skip to content

Commit

Permalink
Merge pull request #26 from tomaka/futures-0.3
Browse files Browse the repository at this point in the history
Update to futures 0.3
  • Loading branch information
matthunz committed Nov 7, 2019
2 parents 0663c0a + 73e3a51 commit 9637cc6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -14,5 +14,5 @@ categories = ["asynchronous", "network-programming"]

[dependencies]
bytes = "0.4.12"
futures-preview = "0.3.0-alpha.17"
futures = "0.3.0"
memchr = "2.2.1"
2 changes: 1 addition & 1 deletion src/codec/bytes.rs
Expand Up @@ -10,7 +10,7 @@ use std::io::Error;
/// #![feature(async_await)]
/// use bytes::Bytes;
/// use futures::{SinkExt, TryStreamExt};
/// use std::io::Cursor;
/// use futures::io::Cursor;
/// use futures_codec::{BytesCodec, Framed};
///
/// async move {
Expand Down
2 changes: 1 addition & 1 deletion src/framed.rs
Expand Up @@ -68,7 +68,7 @@ impl<T: AsyncWrite + Unpin, U> AsyncWrite for Fuse<T, U> {
/// #![feature(async_await)]
/// use bytes::Bytes;
/// use futures::{executor, SinkExt, TryStreamExt};
/// use std::io::Cursor;
/// use futures::io::Cursor;
/// use futures_codec::{BytesCodec, Framed};
///
/// executor::block_on(async move {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -8,7 +8,7 @@
//! ```
//! # #![feature(async_await)]
//! # use futures::{executor, SinkExt, TryStreamExt};
//! # use std::io::Cursor;
//! # use futures::io::Cursor;
//! use futures_codec::{LinesCodec, Framed};
//!
//! async move {
Expand Down
4 changes: 2 additions & 2 deletions tests/bytes.rs
@@ -1,12 +1,12 @@
use futures::{executor, TryStreamExt};
use futures_codec::{BytesCodec, Framed};
use std::io::Cursor;
use futures::io::Cursor;

#[test]
fn decodes() {
let mut buf = [0u8; 32];
let expected = buf.clone();
let cur = Cursor::new(&mut buf);
let cur = Cursor::new(&mut buf[..]);
let mut framed = Framed::new(cur, BytesCodec {});

let read = executor::block_on(framed.try_next()).unwrap().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tests/framed_read.rs
@@ -1,10 +1,10 @@
use futures::executor;
use futures::stream::StreamExt;
use futures::task::Context;
use futures::{AsyncRead, Poll};
use futures::AsyncRead;
use futures_codec::{FramedRead, LinesCodec};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};

// Sends two lines at once, then nothing else forever
struct MockBurstySender {
Expand Down
13 changes: 6 additions & 7 deletions tests/framed_write.rs
@@ -1,13 +1,11 @@
use bytes::Bytes;
use core::iter::Iterator;
use futures::io::AsyncWrite;
use futures::io::{AsyncWrite, Cursor};
use futures::sink::SinkExt;
use futures::task::Context;
use futures::Poll;
use futures::{executor, stream};
use futures::{executor, stream, stream::StreamExt};
use futures_codec::{BytesCodec, FramedWrite, LinesCodec};
use std::io::Cursor;
use std::pin::Pin;
use std::task::{Context, Poll};

// An iterator which outputs a single zero byte up to limit times
struct ZeroBytes {
Expand Down Expand Up @@ -67,7 +65,8 @@ fn line_write() {

#[test]
fn line_write_to_eof() {
let curs = Cursor::new(vec![0u8; 16]);
let mut buf = [0u8; 16];
let curs = Cursor::new(&mut buf[..]);
let mut framer = FramedWrite::new(curs, LinesCodec {});
let _err =
executor::block_on(framer.send("This will fill up the buffer\n".to_owned())).unwrap_err();
Expand All @@ -82,7 +81,7 @@ fn send_high_water_mark() {
let mut stream = stream::iter(ZeroBytes {
count: 0,
limit: 999,
});
}).map(Ok);

// sink will eat whatever it receives
let io = AsyncWriteNull {
Expand Down
2 changes: 1 addition & 1 deletion tests/lines.rs
@@ -1,6 +1,6 @@
use futures::{executor, TryStreamExt};
use futures_codec::{FramedRead, LinesCodec};
use std::io::Cursor;
use futures::io::Cursor;

#[test]
fn it_works() {
Expand Down

0 comments on commit 9637cc6

Please sign in to comment.