Skip to content

Commit 14d7d3b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 342-stream-throttle
2 parents 1fd05a1 + 417b548 commit 14d7d3b

File tree

226 files changed

+8936
-3027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+8936
-3027
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ on:
77
- staging
88
- trying
99

10+
env:
11+
RUSTFLAGS: -Dwarnings
12+
1013
jobs:
1114
build_and_test:
1215
name: Build and test
1316
runs-on: ${{ matrix.os }}
1417
strategy:
1518
matrix:
1619
os: [ubuntu-latest, windows-latest, macOS-latest]
17-
rust: [nightly]
20+
rust: [nightly, beta, stable]
1821

1922
steps:
2023
- uses: actions/checkout@master
@@ -29,13 +32,31 @@ jobs:
2932
uses: actions-rs/cargo@v1
3033
with:
3134
command: check
32-
args: --all --benches --bins --examples --tests
35+
args: --all --bins --tests
3336

3437
- name: check unstable
3538
uses: actions-rs/cargo@v1
3639
with:
3740
command: check
38-
args: --features unstable --all --benches --bins --examples --tests
41+
args: --features unstable --all --bins --examples --tests
42+
- name: check bench
43+
uses: actions-rs/cargo@v1
44+
if: matrix.rust == 'nightly'
45+
with:
46+
command: check
47+
args: --benches
48+
49+
- name: check std only
50+
uses: actions-rs/cargo@v1
51+
with:
52+
command: check
53+
args: --no-default-features --features std
54+
55+
- name: check attributes
56+
uses: actions-rs/cargo@v1
57+
with:
58+
command: check
59+
args: --features attributes
3960

4061
- name: tests
4162
uses: actions-rs/cargo@v1
@@ -49,15 +70,12 @@ jobs:
4970
steps:
5071
- uses: actions/checkout@master
5172

52-
- id: component
53-
uses: actions-rs/components-nightly@v1
54-
with:
55-
component: rustfmt
56-
5773
- uses: actions-rs/toolchain@v1
5874
with:
59-
toolchain: ${{ steps.component.outputs.toolchain }}
75+
profile: minimal
76+
toolchain: nightly
6077
override: true
78+
components: rustfmt
6179

6280
- name: setup
6381
run: |
@@ -74,20 +92,14 @@ jobs:
7492
- name: Docs
7593
run: cargo doc --features docs
7694

77-
clippy_check:
78-
name: Clippy check
79-
runs-on: ubuntu-latest
80-
steps:
81-
- uses: actions/checkout@v1
82-
- id: component
83-
uses: actions-rs/components-nightly@v1
84-
with:
85-
component: clippy
86-
- uses: actions-rs/toolchain@v1
87-
with:
88-
toolchain: ${{ steps.component.outputs.toolchain }}
89-
override: true
90-
- run: rustup component add clippy
91-
- uses: actions-rs/clippy-check@v1
92-
with:
93-
token: ${{ secrets.GITHUB_TOKEN }}
95+
# clippy_check:
96+
# name: Clippy check
97+
# runs-on: ubuntu-latest
98+
# steps:
99+
# - uses: actions/checkout@v1
100+
# - name: Install rust
101+
# run: rustup update beta && rustup default beta
102+
# - name: Install clippy
103+
# run: rustup component add clippy
104+
# - name: clippy
105+
# run: cargo clippy --all --features unstable

CHANGELOG.md

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,113 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
77

88
## [Unreleased]
99

10+
# [0.99.12] - 2019-11-07
11+
12+
[API Documentation](https://docs.rs/async-std/0.99.12/async-std)
13+
14+
This patch upgrades us to `futures` 0.3, support for `async/await` on Rust
15+
Stable, performance improvements, and brand new module-level documentation.
16+
17+
## Added
18+
19+
- Added `Future::flatten` as "unstable".
20+
- Added `Future::race` as "unstable" (replaces `future::select!`).
21+
- Added `Future::try_race` as "unstable" (replaces `future::try_select!`).
22+
- Added `Stderr::lock` as "unstable".
23+
- Added `Stdin::lock` as "unstable".
24+
- Added `Stdout::lock` as "unstable".
25+
- Added `Stream::copied` as "unstable".
26+
- Added `Stream::eq` as "unstable".
27+
- Added `Stream::max_by_key` as "unstable".
28+
- Added `Stream::min` as "unstable".
29+
- Added `Stream::ne` as "unstable".
30+
- Added `Stream::position` as "unstable".
31+
- Added `StreamExt` and `FutureExt` as enumerable in the `prelude`.
32+
- Added `TcpListener` and `TcpStream` integration tests.
33+
- Added `stream::from_iter`.
34+
- Added `sync::WakerSet` for internal use.
35+
- Added an example to handle both `IP v4` and `IP v6` connections.
36+
- Added the `default` Cargo feature.
37+
- Added the `attributes` Cargo feature.
38+
- Added the `std` Cargo feature.
39+
40+
## Changed
41+
42+
- Fixed a bug in the blocking threadpool where it didn't spawn more than one thread.
43+
- Fixed a bug with `Stream::merge` where sometimes it ended too soon.
44+
- Fixed a bug with our GitHub actions setup.
45+
- Fixed an issue where our channels could spuriously deadlock.
46+
- Refactored the `task` module.
47+
- Removed a deprecated GitHub action.
48+
- Replaced `futures-preview` with `futures`.
49+
- Replaced `lazy_static` with `once_cell`.
50+
- Replaced all uses of `VecDequeue` in the examples with `stream::from_iter`.
51+
- Simplified `sync::RwLock` using the internal `sync::WakerSet` type.
52+
- Updated the `path` submodule documentation to match std.
53+
- Updated the mod-level documentation to match std.
54+
55+
## Removed
56+
57+
- Removed `future::select!` (replaced by `Future::race`).
58+
- Removed `future::try_select!` (replaced by `Future::try_race`).
59+
60+
# [0.99.11] - 2019-10-29
61+
62+
This patch introduces `async_std::sync::channel`, a novel asynchronous port of
63+
the ultra-fast Crossbeam channels. This has been one of the most anticipated
64+
features for async-std, and we're excited to be providing a first version of
65+
this!
66+
67+
In addition to channels, this patch has the regular list of new methods, types,
68+
and doc fixes.
69+
70+
## Examples
71+
72+
__Send and receive items from a channel__
73+
```rust
74+
// Create a bounded channel with a max-size of 1
75+
let (s, r) = channel(1);
76+
77+
// This call returns immediately because there is enough space in the channel.
78+
s.send(1).await;
79+
80+
task::spawn(async move {
81+
// This call blocks the current task because the channel is full.
82+
// It will be able to complete only after the first message is received.
83+
s.send(2).await;
84+
});
85+
86+
// Receive items from the channel
87+
task::sleep(Duration::from_secs(1)).await;
88+
assert_eq!(r.recv().await, Some(1));
89+
assert_eq!(r.recv().await, Some(2));
90+
```
91+
92+
## Added
93+
- Added `Future::delay` as "unstable"
94+
- Added `Stream::flat_map` as "unstable"
95+
- Added `Stream::flatten` as "unstable"
96+
- Added `Stream::product` as "unstable"
97+
- Added `Stream::sum` as "unstable"
98+
- Added `Stream::min_by_key`
99+
- Added `Stream::max_by`
100+
- Added `Stream::timeout` as "unstable"
101+
- Added `sync::channel` as "unstable".
102+
- Added doc links from instantiated structs to the methods that create them.
103+
- Implemented `Extend` + `FromStream` for `PathBuf`.
104+
105+
## Changed
106+
- Fixed an issue with `block_on` so it works even when nested.
107+
- Fixed issues with our Clippy check on CI.
108+
- Replaced our uses of `cfg_if` with our own macros, simplifying the codebase.
109+
- Updated the homepage link in `Cargo.toml` to point to [async.rs](https://async.rs).
110+
- Updated the module-level documentation for `stream` and `sync`.
111+
- Various typos and grammar fixes.
112+
- Removed redundant file flushes, improving the performance of `File` operations
113+
114+
## Removed
115+
Nothing was removed in this release.
116+
10117
# [0.99.10] - 2019-10-16
11118

12119
This patch stabilizes several core concurrency macros, introduces async versions
@@ -281,7 +388,8 @@ task::blocking(async {
281388

282389
- Initial beta release
283390

284-
[Unreleased]: https://github.com/async-rs/async-std/compare/v0.99.10...HEAD
391+
[Unreleased]: https://github.com/async-rs/async-std/compare/v0.99.11...HEAD
392+
[0.99.10]: https://github.com/async-rs/async-std/compare/v0.99.10...v0.99.11
285393
[0.99.10]: https://github.com/async-rs/async-std/compare/v0.99.9...v0.99.10
286394
[0.99.9]: https://github.com/async-rs/async-std/compare/v0.99.8...v0.99.9
287395
[0.99.8]: https://github.com/async-rs/async-std/compare/v0.99.7...v0.99.8

Cargo.toml

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async-std"
3-
version = "0.99.10"
3+
version = "0.99.12"
44
authors = [
55
"Stjepan Glavina <[email protected]>",
66
"Yoshua Wuyts <[email protected]>",
@@ -9,7 +9,7 @@ authors = [
99
edition = "2018"
1010
license = "Apache-2.0/MIT"
1111
repository = "https://github.com/async-rs/async-std"
12-
homepage = "https://github.com/async-rs/async-std"
12+
homepage = "https://async.rs"
1313
documentation = "https://docs.rs/async-std"
1414
description = "Async version of the Rust standard library"
1515
keywords = ["async", "await", "future", "std", "task"]
@@ -21,35 +21,67 @@ features = ["docs"]
2121
rustdoc-args = ["--cfg", "feature=\"docs\""]
2222

2323
[features]
24-
docs = ["unstable"]
25-
unstable = ["broadcaster"]
24+
default = [
25+
"std",
26+
"async-task",
27+
"crossbeam-channel",
28+
"crossbeam-deque",
29+
"futures-timer",
30+
"kv-log-macro",
31+
"log",
32+
"mio",
33+
"mio-uds",
34+
"num_cpus",
35+
"pin-project-lite",
36+
]
37+
docs = ["attributes", "unstable"]
38+
unstable = ["default", "broadcaster"]
39+
attributes = ["async-attributes"]
40+
std = [
41+
"async-macros",
42+
"crossbeam-utils",
43+
"futures-core",
44+
"futures-io",
45+
"memchr",
46+
"once_cell",
47+
"pin-project-lite",
48+
"pin-utils",
49+
"slab",
50+
]
2651

2752
[dependencies]
28-
async-macros = "1.0.0"
29-
async-task = "1.0.0"
30-
crossbeam-channel = "0.3.9"
31-
crossbeam-deque = "0.7.1"
32-
crossbeam-utils = "0.6.6"
33-
futures-core-preview = "=0.3.0-alpha.19"
34-
futures-io-preview = "=0.3.0-alpha.19"
35-
futures-timer = "1.0.2"
36-
lazy_static = "1.4.0"
37-
log = { version = "0.4.8", features = ["kv_unstable"] }
38-
memchr = "2.2.1"
39-
mio = "0.6.19"
40-
mio-uds = "0.6.7"
41-
num_cpus = "1.10.1"
42-
pin-utils = "0.1.0-alpha.4"
43-
slab = "0.4.2"
44-
kv-log-macro = "1.0.4"
53+
async-attributes = { version = "1.1.0", optional = true }
54+
async-macros = { version = "1.0.0", optional = true }
55+
async-task = { version = "1.0.0", optional = true }
4556
broadcaster = { version = "0.2.6", optional = true, default-features = false, features = ["default-channels"] }
57+
crossbeam-channel = { version = "0.3.9", optional = true }
58+
crossbeam-deque = { version = "0.7.1", optional = true }
59+
crossbeam-utils = { version = "0.6.6", optional = true }
60+
futures-core = { version = "0.3.0", optional = true }
61+
futures-io = { version = "0.3.0", optional = true }
62+
futures-timer = { version = "1.0.2", optional = true }
63+
kv-log-macro = { version = "1.0.4", optional = true }
64+
log = { version = "0.4.8", features = ["kv_unstable"], optional = true }
65+
memchr = { version = "2.2.1", optional = true }
66+
mio = { version = "0.6.19", optional = true }
67+
mio-uds = { version = "0.6.7", optional = true }
68+
num_cpus = { version = "1.10.1", optional = true }
69+
once_cell = { version = "1.2.0", optional = true }
70+
pin-project-lite = { version = "0.1", optional = true }
71+
pin-utils = { version = "0.1.0-alpha.4", optional = true }
72+
slab = { version = "0.4.2", optional = true }
4673

4774
[dev-dependencies]
4875
femme = "1.2.0"
76+
rand = "0.7.2"
4977
# surf = "1.0.2"
5078
tempdir = "0.3.7"
51-
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
79+
futures = "0.3.0"
80+
81+
[[test]]
82+
name = "stream"
83+
required-features = ["unstable"]
5284

53-
# These are used by the book for examples
54-
futures-channel-preview = "=0.3.0-alpha.19"
55-
futures-util-preview = "=0.3.0-alpha.19"
85+
[[example]]
86+
name = "tcp-ipv4-and-6-echo"
87+
required-features = ["unstable"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ syntax.
6161
## Features
6262

6363
- __Modern:__ Built from the ground up for `std::future` and `async/await` with
64-
blazing fast compilation times.
64+
blazing fast compilation time.
6565
- __Fast:__ Our robust allocator and threadpool designs provide ultra-high
6666
throughput with predictably low latency.
6767
- __Intuitive:__ Complete parity with the stdlib means you only need to learn

benches/mutex.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#![feature(test)]
2+
3+
extern crate test;
4+
5+
use std::sync::Arc;
6+
7+
use async_std::sync::Mutex;
8+
use async_std::task;
9+
use test::Bencher;
10+
11+
#[bench]
12+
fn create(b: &mut Bencher) {
13+
b.iter(|| Mutex::new(()));
14+
}
15+
16+
#[bench]
17+
fn contention(b: &mut Bencher) {
18+
b.iter(|| task::block_on(run(10, 1000)));
19+
}
20+
21+
#[bench]
22+
fn no_contention(b: &mut Bencher) {
23+
b.iter(|| task::block_on(run(1, 10000)));
24+
}
25+
26+
async fn run(task: usize, iter: usize) {
27+
let m = Arc::new(Mutex::new(()));
28+
let mut tasks = Vec::new();
29+
30+
for _ in 0..task {
31+
let m = m.clone();
32+
tasks.push(task::spawn(async move {
33+
for _ in 0..iter {
34+
let _ = m.lock().await;
35+
}
36+
}));
37+
}
38+
39+
for t in tasks {
40+
t.await;
41+
}
42+
}

benches/task.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(test)]
2+
3+
extern crate test;
4+
5+
use async_std::task;
6+
use test::Bencher;
7+
8+
#[bench]
9+
fn block_on(b: &mut Bencher) {
10+
b.iter(|| task::block_on(async {}));
11+
}

0 commit comments

Comments
 (0)