v0.99.11
This patch introduces async_std::sync::channel, a novel asynchronous port of
the ultra-fast Crossbeam channels. This has been one of the most anticipated
features for async-std, and we're excited to be providing a first version of
this!
In addition to channels, this patch has the regular list of new methods, types,
and doc fixes.
Examples
Send and receive items from a channel
// Create a bounded channel with a max-size of 1
let (s, r) = channel(1);
// This call returns immediately because there is enough space in the channel.
s.send(1).await;
task::spawn(async move {
// This call blocks the current task because the channel is full.
// It will be able to complete only after the first message is received.
s.send(2).await;
});
// Receive items from the channel
task::sleep(Duration::from_secs(1)).await;
assert_eq!(r.recv().await, Some(1));
assert_eq!(r.recv().await, Some(2));Added
- Added
Future::delayas "unstable" - Added
Stream::flat_mapas "unstable" - Added
Stream::flattenas "unstable" - Added
Stream::max_by - Added
Stream::min_by_key - Added
Stream::productas "unstable" - Added
Stream::sumas "unstable" - Added
Stream::timeoutas "unstable" - Added
sync::channelas "unstable". - Added doc links from instantiated structs to the methods that create them.
- Implemented
Extend+FromStreamforPathBuf.
Changed
- Fixed an issue with
block_onso it works even when nested. - Fixed issues with our Clippy check on CI.
- Replaced our uses of
cfg_ifwith our own macros, simplifying the codebase. - Updated the homepage link in
Cargo.tomlto point to async.rs. - Updated the module-level documentation for
streamandsync. - Various typos and grammar fixes.
- Removed redundant file flushes, improving the performance of
Fileoperations
Removed
Nothing was removed in this release.