mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
Update to futures 0.2.0-beta (#246)
This commit is contained in:
parent
494f0dc176
commit
8786741ba9
@ -13,11 +13,13 @@ matrix:
|
||||
|
||||
script:
|
||||
- |
|
||||
set -e
|
||||
if [[ "$TRAVIS_RUST_VERSION" == nightly ]]
|
||||
then
|
||||
cargo build --benches --all
|
||||
fi
|
||||
- |
|
||||
set -e
|
||||
if [[ "$TARGET" ]]
|
||||
then
|
||||
rustup target add $TARGET
|
||||
|
@ -8,4 +8,4 @@ repository = "https://github.com/tokio-rs/tokio"
|
||||
homepage = "https://tokio.rs"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.2.0-alpha"
|
||||
futures = "=0.2.0-beta"
|
||||
|
@ -42,7 +42,7 @@ fn echo_server() {
|
||||
});
|
||||
|
||||
let clients = srv.incoming();
|
||||
let client = clients.into_future().map(|e| e.0.unwrap()).map_err(|e| e.0);
|
||||
let client = clients.next().map(|e| e.0.unwrap()).map_err(|e| e.0);
|
||||
let halves = client.map(|s| s.split());
|
||||
let copied = halves.and_then(|(a, b)| a.copy_into(b));
|
||||
|
||||
|
@ -34,7 +34,7 @@ fn hammer() {
|
||||
let srv = t!(TcpListener::bind(&"127.0.0.1:0".parse().unwrap()));
|
||||
let addr = t!(srv.local_addr());
|
||||
let mine = TcpStream::connect(&addr);
|
||||
let theirs = srv.incoming().into_future()
|
||||
let theirs = srv.incoming().next()
|
||||
.map(|(s, _)| s.unwrap())
|
||||
.map_err(|(s, _)| s);
|
||||
let (mine, theirs) = t!(block_on(mine.join(theirs)));
|
||||
|
@ -48,7 +48,7 @@ fn accept() {
|
||||
let client = srv.incoming().map(move |t| {
|
||||
tx.send(()).unwrap();
|
||||
t
|
||||
}).into_future().map_err(|e| e.0);
|
||||
}).next().map_err(|e| e.0);
|
||||
assert!(rx.try_recv().is_err());
|
||||
let t = thread::spawn(move || {
|
||||
net::TcpStream::connect(&addr).unwrap()
|
||||
@ -76,7 +76,7 @@ fn accept2() {
|
||||
let client = srv.incoming().map(move |t| {
|
||||
tx.send(()).unwrap();
|
||||
t
|
||||
}).into_future().map_err(|e| e.0);
|
||||
}).next().map_err(|e| e.0);
|
||||
assert!(rx.try_recv().is_err());
|
||||
|
||||
let (mine, _remaining) = t!(block_on(client));
|
||||
|
@ -16,7 +16,13 @@ use futures::future::lazy;
|
||||
#[cfg(feature = "unstable-futures")]
|
||||
use futures2::prelude::*;
|
||||
#[cfg(feature = "unstable-futures")]
|
||||
use futures2::future::lazy;
|
||||
fn lazy<R, F>(f: F) -> Box<Future<Item = R::Item, Error = R::Error> + Send> where
|
||||
F: Send + 'static + FnOnce() -> R,
|
||||
R: Send + 'static + IntoFuture,
|
||||
R::Future: Send,
|
||||
{
|
||||
Box::new(::futures2::future::lazy(|_| f()))
|
||||
}
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::sync::{mpsc, Arc};
|
||||
@ -416,7 +422,13 @@ fn many_multishot_futures() {
|
||||
}
|
||||
|
||||
for final_rx in final_rxs {
|
||||
block_on(final_rx.into_future()).unwrap();
|
||||
{#![cfg(feature = "unstable-futures")]
|
||||
block_on(final_rx.next()).unwrap();
|
||||
}
|
||||
|
||||
{#![cfg(not(feature = "unstable-futures"))]
|
||||
block_on(final_rx.into_future()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
// Shutdown the pool
|
||||
|
Loading…
x
Reference in New Issue
Block a user