Skip to content

Commit a94e5eb

Browse files
authored
Merge branch 'master' into buffer-unordered-adaptable
2 parents 05481bc + 16afd7c commit a94e5eb

File tree

36 files changed

+243
-225
lines changed

36 files changed

+243
-225
lines changed

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@ matrix:
2525
# This is the minimum Rust version supported by `async-await` feature.
2626
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
2727
- name: cargo build --features async-await (minimum required version)
28-
rust: beta # 1.39.0
28+
rust: 1.39.0
2929
script:
3030
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
31-
- cargo build --all --features async-await
31+
- cargo build --manifest-path futures/Cargo.toml --features async-await
3232

3333
- name: cargo +stable build
3434
rust: stable
3535
script:
3636
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
3737
# Check default-features
3838
- cargo build --all
39-
# Check compat & thread-pool features
39+
# Check compat & thread-pool & async-await features
4040
- cargo build --manifest-path futures/Cargo.toml --features io-compat
4141
- cargo build --manifest-path futures/Cargo.toml --features thread-pool
42+
- cargo build --manifest-path futures/Cargo.toml --features async-await
4243

4344
- name: cargo +beta build
4445
rust: beta

CHANGELOG.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# 0.3.1 - 2019-11-7
2+
* Fix signature of `LocalSpawn` trait (breaking change -- see #1959)
3+
4+
# 0.3.0 - 2019-11-5
5+
* Stable release along with stable async/await!
6+
* Added async/await to default features (#1953)
7+
* Changed `Spawn` trait and `FuturesUnordered::push` to take `&self` (#1950)
8+
* Moved `Spawn` and `FutureObj` out of `futures-core` and into `futures-task (#1925)
9+
* Changed case convention for feature names (#1937)
10+
* Added `executor` feature (#1949)
11+
* Moved `copy_into`/`copy_buf_into` (#1948)
12+
* Changed `SinkExt::send_all` to accept a `TryStream` (#1946)
13+
* Removed `ThreadPool::run` (#1944)
14+
* Changed to use our own definition of `io::Cursor` (#1943)
15+
* Removed `BufReader::poll_seek_relative` (#1938)
16+
* Changed `skip` to take a `usize` rather than `u64` (#1931)
17+
* Removed `Stream` impl for `VecDeque` (#1930)
18+
* Renamed `Peekable::peek` to `poll_peek` (#1928)
19+
* Added immutable iterators for `FuturesUnordered` (#1922)
20+
* Made `ThreadPool` optional (#1910)
21+
* Renamed `oneshot::Sender::poll_cancel` to `poll_canceled` (#1908)
22+
* Added some missing `Clone` implementations
23+
* Documentation fixes
24+
125
# 0.3.0-alpha.19 - 2019-9-25
226
* Stabilized the `async-await` feature (#1816)
327
* Made `async-await` feature no longer require `std` feature (#1815)
@@ -216,7 +240,7 @@
216240
* `FuturesUnordered` optimization: Since the context stores a `&LocalWaker` reference, it was possible to avoid cloning the `Arc` of the waker
217241
* Futures-rs now uses Clippy
218242
* We now use in-band lifetimes
219-
* The `join!` and `select!` macros are now exposed by the `futures-preview` crate
243+
* The `join!` and `select!` macros are now exposed by the `futures` crate
220244
* The project logo was added to the `README.md`
221245
* `sink::MapErr::get_pinned_mut` is now called `get_pin_mut`
222246
* We now use the unstable `use_extern_macros` feature for macro reexports

README.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<img alt="Build Status" src="https://travis-ci.com/rust-lang-nursery/futures-rs.svg?branch=master">
1212
</a>
1313

14-
<a href="https://crates.io/crates/futures-preview">
15-
<img alt="Crates.io" src="https://img.shields.io/crates/v/futures-preview.svg">
14+
<a href="https://crates.io/crates/futures">
15+
<img alt="Crates.io" src="https://img.shields.io/crates/v/futures.svg">
1616
</a>
1717

1818
<a href="https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html">
@@ -21,29 +21,34 @@
2121
</p>
2222

2323
<p align="center">
24-
<a href="https://docs.rs/futures-preview/">
24+
<a href="https://docs.rs/futures/">
2525
Documentation
2626
</a> | <a href="https://rust-lang-nursery.github.io/futures-rs/">
2727
Website
2828
</a>
2929
</p>
3030

31+
`futures-rs` is a library providing the foundations for asynchronous programming in Rust.
32+
It includes key trait definitions like `Stream`, as well as utilities like `join!`,
33+
`select!`, and various futures combinator methods which enable expressive asynchronous
34+
control flow.
35+
3136
## Usage
3237

3338
Add this to your `Cargo.toml`:
3439

3540
```toml
3641
[dependencies]
37-
futures-preview = "=0.3.0-alpha.19"
42+
futures = "0.3"
3843
```
3944

4045
Now, you can use futures-rs:
4146

4247
```rust
43-
use futures::future::Future; // Note: It's not `futures_preview`
48+
use futures::future::Future;
4449
```
4550

46-
The current futures-rs requires Rust 1.36 or later.
51+
The current futures-rs requires Rust 1.39 or later.
4752

4853
### Feature `std`
4954

@@ -53,20 +58,9 @@ a `#[no_std]` environment, use:
5358

5459
```toml
5560
[dependencies]
56-
futures-preview = { version = "=0.3.0-alpha.19", default-features = false }
57-
```
58-
59-
### Feature `async-await`
60-
61-
The `async-await` feature provides several convenient features using async/await. To use futures-rs with async/await, use:
62-
63-
```toml
64-
[dependencies]
65-
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
61+
futures = { version = "0.3.1", default-features = false }
6662
```
6763

68-
The current `async-await` feature requires Rust 1.39 or later.
69-
7064
# License
7165

7266
This project is licensed under either of

futures-channel/Cargo.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "futures-channel-preview"
2+
name = "futures-channel"
33
edition = "2018"
4-
version = "0.3.0-alpha.19"
4+
version = "0.3.1"
55
authors = ["Alex Crichton <[email protected]>"]
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/rust-lang-nursery/futures-rs"
88
homepage = "https://rust-lang-nursery.github.io/futures-rs"
9-
documentation = "https://docs.rs/futures-channel-preview/0.3.0-alpha.19"
9+
documentation = "https://docs.rs/futures-channel/0.3.0"
1010
description = """
1111
Channels for asynchronous communication using futures-rs.
1212
"""
@@ -16,20 +16,20 @@ name = "futures_channel"
1616

1717
[features]
1818
default = ["std"]
19-
std = ["alloc", "futures-core-preview/std"]
20-
alloc = ["futures-core-preview/alloc"]
21-
sink = ["futures-sink-preview"]
19+
std = ["alloc", "futures-core/std"]
20+
alloc = ["futures-core/alloc"]
21+
sink = ["futures-sink"]
2222

2323
# Unstable features
2424
# These features are outside of the normal semver guarantees and require the
2525
# `unstable` feature as an explicit opt-in to unstable API.
26-
unstable = ["futures-core-preview/unstable"]
27-
cfg-target-has-atomic = ["futures-core-preview/cfg-target-has-atomic"]
26+
unstable = ["futures-core/unstable"]
27+
cfg-target-has-atomic = ["futures-core/cfg-target-has-atomic"]
2828

2929
[dependencies]
30-
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }
31-
futures-sink-preview = { path = "../futures-sink", version = "=0.3.0-alpha.19", default-features = false, optional = true }
30+
futures-core = { path = "../futures-core", version = "0.3.1", default-features = false }
31+
futures-sink = { path = "../futures-sink", version = "0.3.1", default-features = false, optional = true }
3232

3333
[dev-dependencies]
34-
futures-preview = { path = "../futures", version = "=0.3.0-alpha.19", default-features = true }
35-
futures-test-preview = { path = "../futures-test", version = "=0.3.0-alpha.19", default-features = true }
34+
futures = { path = "../futures", version = "0.3.1", default-features = true }
35+
futures-test = { path = "../futures-test", version = "0.3.1", default-features = true }

futures-channel/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
1919

20-
#![doc(html_root_url = "https://docs.rs/futures-channel-preview/0.3.0-alpha.19")]
20+
#![doc(html_root_url = "https://docs.rs/futures-channel/0.3.0")]
2121

2222
#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "unstable")))]
2323
compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feature as an explicit opt-in to unstable features");

futures-core/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "futures-core-preview"
2+
name = "futures-core"
33
edition = "2018"
4-
version = "0.3.0-alpha.19"
4+
version = "0.3.1"
55
authors = ["Alex Crichton <[email protected]>"]
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/rust-lang-nursery/futures-rs"
88
homepage = "https://rust-lang-nursery.github.io/futures-rs"
9-
documentation = "https://docs.rs/futures-core-preview/0.3.0-alpha.19"
9+
documentation = "https://docs.rs/futures-core/0.3.0"
1010
description = """
1111
The core traits and types in for the `futures` library.
1212
"""
@@ -28,4 +28,4 @@ cfg-target-has-atomic = []
2828
[dependencies]
2929

3030
[dev-dependencies]
31-
futures-preview = { path = "../futures", version = "=0.3.0-alpha.19" }
31+
futures = { path = "../futures", version = "0.3.1" }

futures-core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
1313

14-
#![doc(html_root_url = "https://docs.rs/futures-core-preview/0.3.0-alpha.19")]
14+
#![doc(html_root_url = "https://docs.rs/futures-core/0.3.0")]
1515

1616
#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "unstable")))]
1717
compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feature as an explicit opt-in to unstable features");

futures-executor/Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "futures-executor-preview"
2+
name = "futures-executor"
33
edition = "2018"
4-
version = "0.3.0-alpha.19"
4+
version = "0.3.1"
55
authors = ["Alex Crichton <[email protected]>"]
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/rust-lang-nursery/futures-rs"
88
homepage = "https://rust-lang-nursery.github.io/futures-rs"
9-
documentation = "https://docs.rs/futures-executor-preview/0.3.0-alpha.19"
9+
documentation = "https://docs.rs/futures-executor/0.3.0"
1010
description = """
1111
Executors for asynchronous tasks based on the futures-rs library.
1212
"""
@@ -16,14 +16,14 @@ name = "futures_executor"
1616

1717
[features]
1818
default = ["std"]
19-
std = ["futures-core-preview/std", "futures-task-preview/std", "futures-util-preview/std"]
19+
std = ["futures-core/std", "futures-task/std", "futures-util/std"]
2020
thread-pool = ["std", "num_cpus"]
2121

2222
[dependencies]
23-
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }
24-
futures-task-preview = { path = "../futures-task", version = "=0.3.0-alpha.19", default-features = false }
25-
futures-util-preview = { path = "../futures-util", version = "=0.3.0-alpha.19", default-features = false }
23+
futures-core = { path = "../futures-core", version = "0.3.1", default-features = false }
24+
futures-task = { path = "../futures-task", version = "0.3.1", default-features = false }
25+
futures-util = { path = "../futures-util", version = "0.3.1", default-features = false }
2626
num_cpus = { version = "1.8.0", optional = true }
2727

2828
[dev-dependencies]
29-
futures-preview = { path = "../futures", version = "=0.3.0-alpha.19" }
29+
futures = { path = "../futures", version = "0.3.1" }

futures-executor/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
1414

15-
#![doc(html_root_url = "https://docs.rs/futures-executor-preview/0.3.0-alpha.19")]
15+
#![doc(html_root_url = "https://docs.rs/futures-executor/0.3.0")]
1616

1717
#[cfg(feature = "std")]
1818
mod local_pool;

futures-executor/src/local_pool.rs

+21-23
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use crate::enter;
22
use futures_core::future::Future;
33
use futures_core::stream::Stream;
44
use futures_core::task::{Context, Poll};
5-
use futures_task::{FutureObj, LocalFutureObj, Spawn, LocalSpawn, SpawnError};
65
use futures_task::{waker_ref, ArcWake};
6+
use futures_task::{FutureObj, LocalFutureObj, LocalSpawn, Spawn, SpawnError};
7+
use futures_util::pin_mut;
78
use futures_util::stream::FuturesUnordered;
89
use futures_util::stream::StreamExt;
9-
use futures_util::pin_mut;
10-
use std::cell::{RefCell};
10+
use std::cell::RefCell;
1111
use std::ops::{Deref, DerefMut};
1212
use std::rc::{Rc, Weak};
1313
use std::sync::Arc;
@@ -40,7 +40,7 @@ pub struct LocalSpawner {
4040
type Incoming = RefCell<Vec<LocalFutureObj<'static, ()>>>;
4141

4242
pub(crate) struct ThreadNotify {
43-
thread: Thread
43+
thread: Thread,
4444
}
4545

4646
thread_local! {
@@ -58,9 +58,10 @@ impl ArcWake for ThreadNotify {
5858
// Set up and run a basic single-threaded spawner loop, invoking `f` on each
5959
// turn.
6060
fn run_executor<T, F: FnMut(&mut Context<'_>) -> Poll<T>>(mut f: F) -> T {
61-
let _enter = enter()
62-
.expect("cannot execute `LocalPool` executor from within \
63-
another executor");
61+
let _enter = enter().expect(
62+
"cannot execute `LocalPool` executor from within \
63+
another executor",
64+
);
6465

6566
CURRENT_THREAD_NOTIFY.with(|thread_notify| {
6667
let waker = waker_ref(thread_notify);
@@ -75,9 +76,10 @@ fn run_executor<T, F: FnMut(&mut Context<'_>) -> Poll<T>>(mut f: F) -> T {
7576
}
7677

7778
fn poll_executor<T, F: FnMut(&mut Context<'_>) -> T>(mut f: F) -> T {
78-
let _enter = enter()
79-
.expect("cannot execute `LocalPool` executor from within \
80-
another executor");
79+
let _enter = enter().expect(
80+
"cannot execute `LocalPool` executor from within \
81+
another executor",
82+
);
8183

8284
CURRENT_THREAD_NOTIFY.with(|thread_notify| {
8385
let waker = waker_ref(thread_notify);
@@ -98,7 +100,7 @@ impl LocalPool {
98100
/// Get a clonable handle to the pool as a [`Spawn`].
99101
pub fn spawner(&self) -> LocalSpawner {
100102
LocalSpawner {
101-
incoming: Rc::downgrade(&self.incoming)
103+
incoming: Rc::downgrade(&self.incoming),
102104
}
103105
}
104106

@@ -164,7 +166,7 @@ impl LocalPool {
164166
/// use futures::future::{ready, pending};
165167
///
166168
/// let mut pool = LocalPool::new();
167-
/// let mut spawner = pool.spawner();
169+
/// let spawner = pool.spawner();
168170
///
169171
/// spawner.spawn_local(ready(())).unwrap();
170172
/// spawner.spawn_local(ready(())).unwrap();
@@ -212,7 +214,7 @@ impl LocalPool {
212214
/// use futures::future::{ready, pending};
213215
///
214216
/// let mut pool = LocalPool::new();
215-
/// let mut spawner = pool.spawner();
217+
/// let spawner = pool.spawner();
216218
///
217219
/// spawner.spawn_local(ready(())).unwrap();
218220
/// spawner.spawn_local(ready(())).unwrap();
@@ -229,7 +231,7 @@ impl LocalPool {
229231
/// of the pool's run or poll methods. While the function is running, all tasks
230232
/// in the pool will try to make progress.
231233
pub fn run_until_stalled(&mut self) {
232-
poll_executor(|ctx| {
234+
poll_executor(|ctx| {
233235
let _ = self.poll_pool(ctx);
234236
});
235237
}
@@ -297,7 +299,9 @@ pub fn block_on_stream<S: Stream + Unpin>(stream: S) -> BlockingStream<S> {
297299

298300
/// An iterator which blocks on values from a stream until they become available.
299301
#[derive(Debug)]
300-
pub struct BlockingStream<S: Stream + Unpin> { stream: S }
302+
pub struct BlockingStream<S: Stream + Unpin> {
303+
stream: S,
304+
}
301305

302306
impl<S: Stream + Unpin> Deref for BlockingStream<S> {
303307
type Target = S;
@@ -332,10 +336,7 @@ impl<S: Stream + Unpin> Iterator for BlockingStream<S> {
332336
}
333337

334338
impl Spawn for LocalSpawner {
335-
fn spawn_obj(
336-
&self,
337-
future: FutureObj<'static, ()>,
338-
) -> Result<(), SpawnError> {
339+
fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError> {
339340
if let Some(incoming) = self.incoming.upgrade() {
340341
incoming.borrow_mut().push(future.into());
341342
Ok(())
@@ -354,10 +355,7 @@ impl Spawn for LocalSpawner {
354355
}
355356

356357
impl LocalSpawn for LocalSpawner {
357-
fn spawn_local_obj(
358-
&self,
359-
future: LocalFutureObj<'static, ()>,
360-
) -> Result<(), SpawnError> {
358+
fn spawn_local_obj(&self, future: LocalFutureObj<'static, ()>) -> Result<(), SpawnError> {
361359
if let Some(incoming) = self.incoming.upgrade() {
362360
incoming.borrow_mut().push(future);
363361
Ok(())

0 commit comments

Comments
 (0)