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

Update to futures 0.3 #26

Merged
merged 1 commit into from Nov 7, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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