Skip to content

Commit f8b8c9d

Browse files
committed
Merge branch 'master' into add_stdin_lock
2 parents 2c91b30 + c1e8517 commit f8b8c9d

File tree

19 files changed

+1180
-86
lines changed

19 files changed

+1180
-86
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ jobs:
5959

6060
- uses: actions-rs/toolchain@v1
6161
with:
62+
profile: minimal
6263
toolchain: ${{ steps.component.outputs.toolchain }}
6364
override: true
65+
components: rustfmt
6466

6567
- name: setup
6668
run: |

CHANGELOG.md

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

88
## [Unreleased]
99

10+
# [0.99.11] - 2019-10-29
11+
12+
This patch introduces `async_std::sync::channel`, a novel asynchronous port of
13+
the ultra-fast Crossbeam channels. This has been one of the most anticipated
14+
features for async-std, and we're excited to be providing a first version of
15+
this!
16+
17+
In addition to channels, this patch has the regular list of new methods, types,
18+
and doc fixes.
19+
20+
## Examples
21+
22+
__Send and receive items from a channel__
23+
```rust
24+
// Create a bounded channel with a max-size of 1
25+
let (s, r) = channel(1);
26+
27+
// This call returns immediately because there is enough space in the channel.
28+
s.send(1).await;
29+
30+
task::spawn(async move {
31+
// This call blocks the current task because the channel is full.
32+
// It will be able to complete only after the first message is received.
33+
s.send(2).await;
34+
});
35+
36+
// Receive items from the channel
37+
task::sleep(Duration::from_secs(1)).await;
38+
assert_eq!(r.recv().await, Some(1));
39+
assert_eq!(r.recv().await, Some(2));
40+
```
41+
42+
## Added
43+
- Added `Future::delay` as "unstable"
44+
- Added `Stream::flat_map` as "unstable"
45+
- Added `Stream::flatten` as "unstable"
46+
- Added `Stream::product` as "unstable"
47+
- Added `Stream::sum` as "unstable"
48+
- Added `Stream::min_by_key`
49+
- Added `Stream::max_by`
50+
- Added `Stream::timeout` as "unstable"
51+
- Added `sync::channel` as "unstable".
52+
- Added doc links from instantiated structs to the methods that create them.
53+
- Implemented `Extend` + `FromStream` for `PathBuf`.
54+
55+
## Changed
56+
- Fixed an issue with `block_on` so it works even when nested.
57+
- Fixed issues with our Clippy check on CI.
58+
- Replaced our uses of `cfg_if` with our own macros, simplifying the codebase.
59+
- Updated the homepage link in `Cargo.toml` to point to [async.rs](https://async.rs).
60+
- Updated the module-level documentation for `stream` and `sync`.
61+
- Various typos and grammar fixes.
62+
- Removed redundant file flushes, improving the performance of `File` operations
63+
64+
## Removed
65+
Nothing was removed in this release.
66+
1067
# [0.99.10] - 2019-10-16
1168

1269
This patch stabilizes several core concurrency macros, introduces async versions
@@ -281,7 +338,8 @@ task::blocking(async {
281338

282339
- Initial beta release
283340

284-
[Unreleased]: https://github.com/async-rs/async-std/compare/v0.99.10...HEAD
341+
[Unreleased]: https://github.com/async-rs/async-std/compare/v0.99.11...HEAD
342+
[0.99.10]: https://github.com/async-rs/async-std/compare/v0.99.10...v0.99.11
285343
[0.99.10]: https://github.com/async-rs/async-std/compare/v0.99.9...v0.99.10
286344
[0.99.9]: https://github.com/async-rs/async-std/compare/v0.99.8...v0.99.9
287345
[0.99.8]: https://github.com/async-rs/async-std/compare/v0.99.7...v0.99.8

Cargo.toml

Lines changed: 2 additions & 2 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.11"
44
authors = [
55
"Stjepan Glavina <[email protected]>",
66
"Yoshua Wuyts <[email protected]>",
@@ -33,12 +33,12 @@ crossbeam-utils = "0.6.6"
3333
futures-core-preview = "=0.3.0-alpha.19"
3434
futures-io-preview = "=0.3.0-alpha.19"
3535
futures-timer = "1.0.2"
36-
lazy_static = "1.4.0"
3736
log = { version = "0.4.8", features = ["kv_unstable"] }
3837
memchr = "2.2.1"
3938
mio = "0.6.19"
4039
mio-uds = "0.6.7"
4140
num_cpus = "1.10.1"
41+
once_cell = "1.2.0"
4242
pin-utils = "0.1.0-alpha.4"
4343
slab = "0.4.2"
4444
kv-log-macro = "1.0.4"

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

src/net/driver/mod.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fmt;
22
use std::sync::{Arc, Mutex};
33

4-
use lazy_static::lazy_static;
54
use mio::{self, Evented};
5+
use once_cell::sync::Lazy;
66
use slab::Slab;
77

88
use crate::io;
@@ -100,25 +100,23 @@ impl Reactor {
100100
// }
101101
}
102102

103-
lazy_static! {
104-
/// The state of the global networking driver.
105-
static ref REACTOR: Reactor = {
106-
// Spawn a thread that waits on the poller for new events and wakes up tasks blocked on I/O
107-
// handles.
108-
std::thread::Builder::new()
109-
.name("async-net-driver".to_string())
110-
.spawn(move || {
111-
// If the driver thread panics, there's not much we can do. It is not a
112-
// recoverable error and there is no place to propagate it into so we just abort.
113-
abort_on_panic(|| {
114-
main_loop().expect("async networking thread has panicked");
115-
})
103+
/// The state of the global networking driver.
104+
static REACTOR: Lazy<Reactor> = Lazy::new(|| {
105+
// Spawn a thread that waits on the poller for new events and wakes up tasks blocked on I/O
106+
// handles.
107+
std::thread::Builder::new()
108+
.name("async-net-driver".to_string())
109+
.spawn(move || {
110+
// If the driver thread panics, there's not much we can do. It is not a
111+
// recoverable error and there is no place to propagate it into so we just abort.
112+
abort_on_panic(|| {
113+
main_loop().expect("async networking thread has panicked");
116114
})
117-
.expect("cannot start a thread driving blocking tasks");
115+
})
116+
.expect("cannot start a thread driving blocking tasks");
118117

119-
Reactor::new().expect("cannot initialize reactor")
120-
};
121-
}
118+
Reactor::new().expect("cannot initialize reactor")
119+
});
122120

123121
/// Waits on the poller for new events and wakes up tasks blocked on I/O handles.
124122
fn main_loop() -> io::Result<()> {

src/net/mod.rs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
//! Networking primitives for TCP/UDP communication.
22
//!
3-
//! For OS-specific networking primitives like Unix domain sockets, refer to the [`async_std::os`]
4-
//! module.
3+
//! This module provides networking functionality for the Transmission Control and User
4+
//! Datagram Protocols, as well as types for IP and socket addresses.
55
//!
66
//! This module is an async version of [`std::net`].
77
//!
8+
//! # Organization
9+
//!
10+
//! * [`TcpListener`] and [`TcpStream`] provide functionality for communication over TCP
11+
//! * [`UdpSocket`] provides functionality for communication over UDP
12+
//! * [`IpAddr`] represents IP addresses of either IPv4 or IPv6; [`Ipv4Addr`] and
13+
//! [`Ipv6Addr`] are respectively IPv4 and IPv6 addresses
14+
//! * [`SocketAddr`] represents socket addresses of either IPv4 or IPv6; [`SocketAddrV4`]
15+
//! and [`SocketAddrV6`] are respectively IPv4 and IPv6 socket addresses
16+
//! * [`ToSocketAddrs`] is a trait that used for generic address resolution when interacting
17+
//! with networking objects like [`TcpListener`], [`TcpStream`] or [`UdpSocket`]
18+
//! * Other types are return or parameter types for various methods in this module
19+
//!
20+
//! [`IpAddr`]: enum.IpAddr.html
21+
//! [`Ipv4Addr`]: struct.Ipv4Addr.html
22+
//! [`Ipv6Addr`]: struct.Ipv6Addr.html
23+
//! [`SocketAddr`]: enum.SocketAddr.html
24+
//! [`SocketAddrV4`]: struct.SocketAddrV4.html
25+
//! [`SocketAddrV6`]: struct.SocketAddrV6.html
26+
//! [`TcpListener`]: struct.TcpListener.html
27+
//! [`TcpStream`]: struct.TcpStream.html
28+
//! [`ToSocketAddrs`]: trait.ToSocketAddrs.html
29+
//! [`UdpSocket`]: struct.UdpSocket.html
30+
//!
31+
//! # Platform-specific extensions
32+
//!
33+
//! APIs such as Unix domain sockets are available on certain platforms only. You can find
34+
//! platform-specific extensions in the [`async_std::os`] module.
35+
//!
836
//! [`async_std::os`]: ../os/index.html
937
//! [`std::net`]: https://doc.rust-lang.org/std/net/index.html
1038
//!
11-
//! ## Examples
39+
//! # Examples
1240
//!
1341
//! A simple UDP echo server:
1442
//!

0 commit comments

Comments
 (0)