async-std
Deprecated in favor of `smol` - Async version of the Rust standard library
1.13.2
90M downloads/mo
#858 most downloaded on crates.io
async-rs/async-std
What this package is like to depend on
Last release 1 years ago
15 Aug 2025
Ships unpredictably
gaps range from 2 weeks to 2.2 years
Most releases are documented
notes for 31 of 36 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
38 releases · first in 2019
0 releases in the last 12 months
see the full history below
Release timeline
38 releases · May 2019 to Aug 2025Releases
latest 38-
1.13.215 Aug 2025Nothing published for this version
-
1.13.115 Mar 2025Release notes
Open source →async-stdhas officially been discontinued. We recommend that all users and libraries migrate to the excellentsmolproject.We created
async-stdto demonstrate the value of making a library as close tostdas possible, but async. We think that demonstration was successful, and we hope it will influence future design and development directions of async instd. However, in the meantime, thesmolproject came about and provided a great executor and libraries for asynchronous use in the Rust ecosystem. We think that resources would be better spent consolidating aroundsmol, rather than continuing to provide occasional maintenance ofasync-std. As such, we recommend that all users ofasync-std, and all libraries built onasync-std, switch tosmolinstead.In addition to the
smolproject as a direct replacement, you may find other parts of the futures ecosystem useful, includingfutures-concurrency,async-io,futures-lite, andasync-compat.Release notes
Open source →async-stdhas officially been discontinued. We recommend that all users and libraries migrate to the excellentsmolproject. -
1.13.006 Sep 2024Release notes
Open source →Added
- IO Safety traits implementations
Changed
- Various dependencies updates
- Export
BufReadExtandSeekExtfromasync_std::io
Release notes
Open source →Added
- IO Safety traits implementations
Changed
- Various dependencies updates
- Export
BufReadExtandSeekExtfromasync_std::io
-
1.12.018 Jun 2022Release notes
Open source →This release stabilizes some long-
awaited APIs that help people build async interfaces and interoperate with other APIs.Added
task::spawn_blockingis now stabilized. We consider it a fundamental API for bridging between blocking code and async code, and we widely use it within async-std's own implementation.- Add
TryFromimplementations to convertTcpListener,TcpStream,UdpSocket,UnixDatagram,UnixListener, andUnixStreamto their synchronous equivalents, including putting them back into blocking mode.
Changed
- async-std no longer depends on
num_cpus; it uses functionality in the standard library instead (viaasync-global-executor). - Miscellaneous documentation fixes and cleanups.
Release notes
Open source →Added
async_std::task::spawn_blockingis now stabilized. We consider it a fundamental API for bridging between blocking code and async code, and we widely use it within async-std's own implementation.- Add
TryFromimplementations to convertTcpListener,TcpStream,UdpSocket,UnixDatagram,UnixListener, andUnixStreamto their synchronous equivalents, including putting them back into blocking mode.
Changed
- async-std no longer depends on
num_cpus; it uses functionality in the standard library instead (viaasync-global-executor). - Miscellaneous documentation fixes and cleanups.
-
1.11.022 Mar 2022Release notes
Open source →This release improves compile times by up to 55% on initial builds, and up to 75% on recompilation. Additionally we've added a few new APIs and made some tweaks.
Added
TcpListener::into_incomingto convert aTcpListenerinto a stream of incoming TCP connections
Removed
- The internal
extension_traitmacro had been removed. This drastically improves compile times forasync-std, but changes the way our documentation is rendered. This is a cosmetic change only, and all existing code should continue to work as it did be
fore.
Changed
- Some internal code has been de-macro-ified, making for quicker compile times.
- We now use the default recursion limit.
Docs
- Several docs improvements / fixes.
Release notes
Open source →This release improves compile times by up to 55% on initial builds, and up to 75% on recompilation. Additionally we've added a few new APIs and made some tweaks.
Added
TcpListener::into_incomingto convert aTcpListenerinto a stream of incoming TCP connections
Removed
- The internal
extension_traitmacro had been removed. This drastically improves compile times forasync-std, but changes the way our documentation is rendered. This is a cosmetic change only, and all existing code should continue to work as it did before.
Changed
- Some internal code has been de-macro-ified, making for quicker compile times.
- We now use the default recursion limit.
Docs
- Several docs improvements / fixes.
-
1.10.026 Aug 2021Release notes
Open source →This release comes with an assortment of small features and fixes.
Added
Filenow implementsCloneso thatFiles can be passed into closures for use inspawn_blocking.File's contents are already wrapped inArcs, so the implementation ofCloneis straightforward.
task::try_current()which returns a handle to the current task if called within the context of a task created by async-std.async_std::ionow re-exportsWriteExtdirectly.
Fixed
write!now takes already written bytes into account onFile.
Internal
TcpStreamnow properly makes use of vectored IO.- The
net::*::Incomingimplementations now do less allocation.
Docs
- Several docs improvements / fixes.
-
1.9.015 Jan 2021Release notes
Open source →Happy New Year everyone! This patch stabilizes the
async_std::channel
submodule, removes the deprecatedsync::channeltypes, and introduces the
tokio1feature.New Channels
As part of our
1.8.0release last month we introduced the new
async_std::channelsubmodule and deprecated the unstable
async_std::sync::channeltypes. You can read our full motiviation for this
change in the last patch notes. But the short version is that the old
channels had some fundamental problems, and thesyncsubmodule is a bit of
a mess.This release of
async-stdpromotesasync_std::channelto stable, and
fully removes theasync_std::sync::channeltypes. In practice many
libraries have already been upgraded to the new channels in the past month,
and this will enable much of the ecosystem to switch off "unstable" versions
ofasync-std.use async_std::channel; let (sender, receiver) = channel::unbounded(); assert_eq!(sender.send("Hello").await, Ok(())); assert_eq!(receiver.recv().await, Ok("Hello"));
Tokio 1.0 compat
The Tokio project recently released version 1.0 of their runtime, and the
async-std team would like to congratulate the Tokio team on achieving this
milestone.This release of
async-stdadds thetokio1feature flag, enabling Tokio's
TLS constructors to be initialized within theasync-stdruntime. This is in
addition to thetokio02andtokio03feature flags which we were already
exposing.In terms of stability it's worth noting that we will continue to provide
support for thetokio02,tokio03, andtokio1on the current major
release line ofasync-std. These flags are part of our public API, and
removing compat support for older Tokio versions is considered a breaking
change.Added
Removed
- Removed deprecated
sync::channel(#933)
Fixed
- Fixed a typo for [sic]
FuturesExttrait (#930) - Update the link to
cargo-editin the installation section of the docs (#932) - Fixed a small typo for stream (#926)
Internal
Release notes
Open source →This patch stabilizes the
async_std::channelsubmodule, removes the deprecatedsync::channeltypes, and introduces thetokio1feature.New Channels
As part of our
1.8.0release last month we introduced the newasync_std::channelsubmodule and deprecated the unstableasync_std::sync::channeltypes. You can read our full motivation for this change in the last patch notes. But the short version is that the old channels had some fundamental problems, and thesyncsubmodule is a bit of a mess.This release of
async-stdpromotesasync_std::channelto stable, and fully removes theasync_std::sync::channeltypes. In practice many libraries have already been upgraded to the new channels in the past month, and this will enable much of the ecosystem to switch off "unstable" versions ofasync-std.use async_std::channel; let (sender, receiver) = channel::unbounded(); assert_eq!(sender.send("Hello").await, Ok(())); assert_eq!(receiver.recv().await, Ok("Hello"));Tokio 1.0 compat
The Tokio project recently released version 1.0 of their runtime, and the async-std team would like to congratulate the Tokio team on achieving this milestone.
This release of
async-stdadds thetokio1feature flag, enabling Tokio's TLS constructors to be initialized within theasync-stdruntime. This is in addition to thetokio02andtokio03feature flags which we were already exposing.In terms of stability it's worth noting that we will continue to provide support for the
tokio02,tokio03, andtokio1on the current major release line ofasync-std. These flags are part of our public API, and removing compat support for older Tokio versions is considered a breaking change.Added
Removed
- Removed deprecated
sync::channel(#933)
Fixed
- Fixed a typo for [sic]
FuturesExttrait (#930) - Update the link to
cargo-editin the installation section of the docs (#932) - Fixed a small typo for stream (#926)
Internal
- Removed deprecated
-
1.8.008 Dec 2020Release notes
Open source →This patch introduces
async_std::channel, a new submodule for our async channels implementation.channelshave been one of async-std's most requested features, and have existed as "unstable" for the past year. We've been cautious about stabilizing channels, and this caution turned out to be warranted: we realized our channels could hang indefinitely under certain circumstances, and people ended up expressing a need for unbounded channels.So today we're introducing the new
async_std::channelsubmodule which exports theasync-channelcrate, and we're marking the older unstableasync_std::sync::channelAPI as "deprecated". This release includes both APIs, but we intend to stabilizeasync_std::channeland remove the older API in January. This should give dependent projects a month to upgrade, though we can extend that if it proves to be too short.The rationale for adding a new top-level
channelsubmodule, rather than extendingsyncis that thestd::syncandasync_std::syncsubmodule are a bit of a mess, and the libs team has been talking about splittingstd::syncup into separate modules. The stdlib has to guarantee it'll forever be backwards compatible, butasync-stddoes not (we fully expect a 2.0 once we have async closures & traits). So we're experimenting with this change beforestddoes, with the expectation that this change can serve as a data point when the libs team decides how to proceed in std.Added
Fixed
- Fixed mentions of the
tokio03flags in the docs #909 - Fixed a double drop issue in
StreamExt::cycle#903
Internal
- updated
pin-projecttov0.2.0
Release notes
Open source →This patch introduces
async_std::channel, a new submodule for our async channels implementation.channelshave been one of async-std's most requested features, and have existed as "unstable" for the past year. We've been cautious about stabilizing channels, and this caution turned out to be warranted: we realized our channels could hang indefinitely under certain circumstances, and people ended up expressing a need for unbounded channels.So today we're introducing the new
async_std::channelsubmodule which exports theasync-channelcrate, and we're marking the older unstableasync_std::sync::channelAPI as "deprecated". This release includes both APIs, but we intend to stabilizeasync_std::channeland remove the older API in January. This should give dependent projects a month to upgrade, though we can extend that if it proves to be too short.The rationale for adding a new top-level
channelsubmodule, rather than extendingsyncis that thestd::syncandasync_std::syncsubmodule are a bit of a mess, and the libs team has been talking about splittingstd::syncup into separate modules. The stdlib has to guarantee it'll forever be backwards compatible, butasync-stddoes not (we fully expect a 2.0 once we have async closures & traits). So we're experimenting with this change beforestddoes, with the expectation that this change can serve as a data point when the libs team decides how to proceed in std.Added
async_std::channelas "unstable" #915async_std::processas "unstable" #916
Fixed
- Fixed mentions of the
tokio03flags in the docs #909 - Fixed a double drop issue in
StreamExt::cycle#903
Internal
- updated
pin-projecttov0.2.0
- Fixed mentions of the
-
1.7.004 Nov 2020Release notes
Open source →This patch adds a feature to enable compatibility with the new
tokio0.3.0 release, and updates internal dependencies.Tokio 0.3.x compat
Since earlier this year
async-stdhas shipped with atokio-02feature flag that enables libraries written for thetokioruntime to work onasync-stdas well. When this flag is enabledasync-stdensures that whenever it spawns a thread on its executor, the right tokio-specific thread state is initialized for it. That means no morethread 'main' panicked at 'not currently running on the Tokio runtime.'errors when runningasync-stdandtokioin the same application.This patch introduces a new feature flag:
tokio-03which enables the same mechanism for the latest version of thetokioruntime. As applications migrate fromtokio0.2.x to 0.3.x, mixing dependencies that use bothasync-stdandtokiowill continue to work.Added
- Add
tokio03feature flag (#895)
Internal
- chore: update dependencies (#897)
Release notes
Open source →This patch adds a feature to enable compatibility with the new
tokio0.3.0 release, and updates internal dependencies.Added
- Add
tokio03feature (#895)
Internal
- chore: update dependencies (#897)
- Add
-
1.6.528 Sep 2020Release notes
Open source →Release notes
Open source → -
1.6.417 Sep 2020Release notes
Open source →Added
- Added
UdpSocket::peekandUdpSocket::peek_from(#853)
Changed
-
Extracted the executor into async-global-executor (#867)
-
Updated various dependencies
Fixed
- Added
-
1.6.313 Aug 2020Release notes
Open source →Added
Changed
- Switched from smol to individual executor parts. (#836)
- Replaced internal
Muteximplementation withasync-mutex. (#822)
Fixed
- Added missing
Sendguards toStream::collect. (#665)
-
1.6.219 Jun 2020 -
1.6.111 Jun 2020Release notes
Open source →Added
- Added
tokio02feature flag, to allow compatibility usage with [email protected] (#804).
Changed
- Removed unstable
stdiolock methods, due to their unsoundness (#807).
Fixed
- Added
-
1.6.022 May 2020 -
1.6.0-beta.220 May 2020 pre-releaseRelease notes
Open source →Added
- Added an environment variable to configure the thread pool size of the runtime. (#774)
- Implement
CloneforUnixStream(#772)
Changed
- For
wasm, switched underlyingTimerimplementation tofutures-timer. (#776)
Fixed
- Use
smol::block_onto handle drop ofFile, avoiding nested executor panic. (#768)
-
1.6.0-beta.107 May 2020 pre-releaseRelease notes
Open source →Added
- Added
task::spawn_local. (#757) - Added out of the box support for
wasm. (#757) - Added
JoinHandle::cancel(#757) - Added
sync::Condvar(#369) - Added
sync::Sender::try_sendandsync::Receiver::try_recv(#585) - Added
no_stdsupport fortask,futureandstream(#680)
Changed
- Switched underlying runtime to
smol. (#757) - Switched implementation of
sync::Barrierto usesync::Condvarlikestddoes. (#581)
Fixed
- Allow compilation on 32 bit targets, by using
AtomicUsizeforTaskId. (#756)
- Added
-
1.5.003 Feb 2020Release notes
Open source →This patch includes various quality of life improvements to async-std. Including improved performance, stability, and the addition of various
Cloneimpls that replace the use ofArcin many cases.Added
- Added links to various ecosystem projects from the README (#660)
- Added an example on
FromStreamforResult<T, E>(#643) - Added
stream::pendingas "unstable" (#615) - Added an example of
stream::timeoutto document the error flow (#675) - Implement
CloneforDirEntry(#682) - Implement
CloneforTcpStream(#689)
Changed
- Removed internal comment on
stream::Interval(#645) - The "unstable" feature can now be used without requiring the "default" feature (#647)
- Removed unnecessary trait bound on
stream::FlatMap(#651) - Updated the "broadcaster" dependency used by "unstable" to
1.0.0(#681) - Updated
async-taskto 1.2.1 (#676) task::block_onnow parks after a single poll, improving performance in many cases (#684)- Improved reading flow of the "client" part of the async-std tutorial (#550)
- Use
take_whileinstead ofscaninimplofProduct,SumandFromStream(#667) TcpStream::connectno longer uses a thread from the threadpool, improving performance (#687)
Fixed
- Fixed crate documentation typo (#655)
- Fixed documentation for
UdpSocket::recv(#648) - Fixed documentation for
UdpSocket::send(#671) - Fixed typo in stream documentation (#650)
- Fixed typo on
sync::JoinHandledocumentation (#659) - Removed use of
std::error::Error::descriptionwhich failed CI (#661) - Removed the use of rustfmt's unstable
format_code_in_doc_commentsoption which failed CI (#685) - Fixed a code typo in the
task::sleepexample (#688)
-
1.4.020 Dec 2019Release notes
Open source →This patch adds
Future::timeout, providing a method counterpart to thefuture::timeoutfree function. And includes several bug fixes around missing APIs. Notably we're not shipping our new executor yet, first announced on our blog.Examples
use async_std::prelude::*; use async_std::future; use std::time::Duration; let fut = future::pending::<()>(); // This future will never resolve. let res = fut.timeout(Duration::from_millis(100)).await; assert!(res.is_err()); // The future timed out, returning an err.Added
- Added
Future::timeoutas "unstable" (#600)
Fixes
- Fixed a doc test and enabled it on CI (#597)
- Fixed a rendering issue with the
streamsubmodule documentation (#621) Write::write_fmt's future is now correctly marked as#[must_use](#628)- Fixed the missing
io::Bytesexport (#633) - Fixed the missing
io::Chainexport (#633) - Fixed the missing
io::Takeexport (#633)
- Added
-
1.3.013 Dec 2019Release notes
Open source →This patch introduces
Stream::delay, more methods onDoubleEndedStream, and improves compile times.Stream::delayis a new API that's similar totask::sleep, but can be passed as part of as stream, rather than as a separate block. This is useful for examples, or when manually debugging race conditions.Examples
let start = Instant::now(); let mut s = stream::from_iter(vec![0u8, 1]).delay(Duration::from_millis(200)); // The first time will take more than 200ms due to delay. s.next().await; assert!(start.elapsed().as_millis() >= 200); // There will be no delay after the first time. s.next().await; assert!(start.elapsed().as_millis() <= 210);Added
- Added
Stream::delayas "unstable" (#309) - Added
DoubleEndedStream::next_backas "unstable" (#562) - Added
DoubleEndedStream::nth_backas "unstable" (#562) - Added
DoubleEndedStream::rfindas "unstable" (#562) - Added
DoubleEndedStream::rfoldas "unstable" (#562) - Added
DoubleEndedStream::try_rfoldas "unstable" (#562) stream::Oncenow implementsDoubleEndedStream(#562)stream::FromIternow implementsDoubleEndedStream(#562)
Changed
- Removed our dependency on
async-macros, speeding up compilation (#610)
Fixes
- Fixed a link in the task docs (#598)
- Fixed the
UdpSocket::recvexample (#603) - Fixed a link to
task::block_on(#608) - Fixed an incorrect API mention in
task::Builder(#612) - Fixed leftover mentions of
futures-preview(#595) - Fixed a typo in the tutorial (#614)
<TcpStream as Write>::poll_closenow closes the write half of the stream (#618)
- Added
-
1.2.027 Nov 2019Release notes
Open source →This patch includes some minor quality-of-life improvements, introduces a new
Stream::unzipAPI, and adds verbose errors to our networking types.This means if you can't connect to a socket, you'll never have to wonder again which address it was you couldn't connect to, instead of having to go through the motions to debug what the address was.
Example
Unzip a stream of tuples into two collections:
use async_std::prelude::*; use async_std::stream; let s = stream::from_iter(vec![(1,2), (3,4)]); let (left, right): (Vec<_>, Vec<_>) = s.unzip().await; assert_eq!(left, [1, 3]); assert_eq!(right, [2, 4]);Added
- Added
Stream::unzipas "unstable". - Added verbose errors to the networking types.
Changed
- Enabled CI.
Future::joinandFuture::try_joincan now join futures with different output types.
Fixed
- Fixed the docs and
Debugoutput ofBufWriter. - Fixed a bug in
Stream::throttlethat made it consume too much CPU.
- Added
-
1.1.021 Nov 2019Release notes
Open source →This patch introduces a faster scheduler algorithm,
Stream::throttle, and stabilizestask::yield_now. Additionally we're introducing several more stream APIs, bringing us to almost complete parity with the standard library.Furthermore our
pathsubmodule now returns more context in errors. So if opening a file fails, async-std will tell you which file was failed to open, making it easier to write and debug programs.Examples
let start = Instant::now(); let mut s = stream::interval(Duration::from_millis(5)) .throttle(Duration::from_millis(10)) .take(2); s.next().await; assert!(start.elapsed().as_millis() >= 5); s.next().await; assert!(start.elapsed().as_millis() >= 15); s.next().await; assert!(start.elapsed().as_millis() >= 25);Added
- Added
Stream::throttleas "unstable". - Added
Stream::countas "unstable". - Added
Stream::maxas "unstable". - Added
Stream::successorsas "unstable". - Added
Stream::by_refas "unstable". - Added
Stream::partitionas "unstable". - Added contextual errors to the
pathsubmodule. - Added
os::windows::symlink_diras "unstable". - Added
os::windows::symlink_fileas "unstable". - Stabilized
task::yield_now.
Fixes
- We now ignore seek errors when rolling back failed
readcalls onFile. - Fixed a bug where
Stream::max_by_keywas returning the wrong result. - Fixed a bug where
Stream::min_by_keywas returning the wrong result.
Changed
- Applied various fixes to the tutorial.
- Fixed an issue with Clippy.
- Optimized an internal code generation macro, improving compilation speeds.
- Removed an
Unpinbound fromstream::Once. - Removed various extra internal uses of
pin_mut!. - Simplified
Stream::anyandStream::all's internals. - The
surfexample is now enabled again. - Tweaked some streams internals.
- Updated
futures-timerto 2.0.0, improving compilation speed. - Upgraded
async-macrosto 2.0.0. Stream::mergenow uses randomized ordering to reduce overall latency.- The scheduler is now more efficient by keeping a slot for the next task to run. This is similar to Go's scheduler, and Tokio's scheduler.
- Fixed the documentation of the
channeltypes to link back to thechannelfunction.
- Added
-
1.0.112 Nov 2019Release notes
Open source →We were seeing a regression in our fs performance, caused by too many long-running tasks. This patch fixes that regression by being more proactive about closing down idle threads.
Changes
- Improved thread startup/shutdown algorithm in
task::spawn_blocking. - Fixed a typo in the tutorial.
- Improved thread startup/shutdown algorithm in
-
1.0.011 Nov 2019Release notes
Open source →This release marks the
1.0.0release of async-std; a major milestone for our development. This release itself mostly includes quality of life improvements for all of modules, including more consistent API bounds for a lot of our submodules.The biggest change is that we're now using the full semver range,
major.minor.patch, and any breaking changes to our "stable" APIs will require an update of themajornumber.We're excited we've hit this milestone together with you all. Thank you!
Added
- Added
Future::joinas "unstable", replacingfuture::join!. - Added
Future::try_joinas "unstable", replacingfuture::try_join!. - Enabled
stableandbetachannel testing on CI. - Implemented
FromIteratorandExtendforPathBuf. - Implemented
FromStreamforPathBuf. - Loosened the trait bounds of
io::copyon "unstable".
Changed
- Added a
Syncbound toRwLock, resolving a memory safety issue. - Fixed a bug in
Stream::take_whilewhere it could continue after it should've ended. - Fixed a bug where our
attributesCargo feature wasn't working as intended. - Improved documentation of
Stream::merge, documenting ordering guarantees. - Update doc imports in examples to prefer async-std's types.
- Various quality of life improvements to the
futuresubmodule. - Various quality of life improvements to the
pathsubmodule. - Various quality of life improvements to the
streamsubmodule.
Removed
- Removed
future::join!in favor ofFuture::join. - Removed
future::try_join!in favor ofFuture::try_join.
- Added
-
0.99.1208 Nov 2019Release notes
Open source →This patch upgrades us to
futures0.3, support forasync/awaiton Rust Stable, performance improvements, and brand new module-level documentation.Added
- Added
Future::flattenas "unstable". - Added
Future::raceas "unstable" (replacesfuture::select!). - Added
Future::try_raceas "unstable" (replacesfuture::try_select!). - Added
Stderr::lockas "unstable". - Added
Stdin::lockas "unstable". - Added
Stdout::lockas "unstable". - Added
Stream::copiedas "unstable". - Added
Stream::eqas "unstable". - Added
Stream::max_by_keyas "unstable". - Added
Stream::minas "unstable". - Added
Stream::neas "unstable". - Added
Stream::positionas "unstable". - Added
StreamExtandFutureExtas enumerable in theprelude. - Added
TcpListenerandTcpStreamintegration tests. - Added
stream::from_iter. - Added
sync::WakerSetfor internal use. - Added an example to handle both
IP v4andIP v6connections. - Added the
defaultCargo feature. - Added the
attributesCargo feature. - Added the
stdCargo feature.
Changed
- Fixed a bug in the blocking threadpool where it didn't spawn more than one thread.
- Fixed a bug with
Stream::mergewhere sometimes it ended too soon. - Fixed a bug with our GitHub actions setup.
- Fixed an issue where our channels could spuriously deadlock.
- Refactored the
taskmodule. - Removed a deprecated GitHub action.
- Replaced
futures-previewwithfutures. - Replaced
lazy_staticwithonce_cell. - Replaced all uses of
VecDequeuein the examples withstream::from_iter. - Simplified
sync::RwLockusing the internalsync::WakerSettype. - Updated the
pathsubmodule documentation to match std. - Updated the mod-level documentation to match std.
Removed
- Removed
future::select!(replaced byFuture::race). - Removed
future::try_select!(replaced byFuture::try_race).
- Added
-
0.99.1129 Oct 2019Release notes
Open source →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::productas "unstable" - Added
Stream::sumas "unstable" - Added
Stream::min_by_key - Added
Stream::max_by - 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.
- Added
-
0.99.1016 Oct 2019Release notes
Open source →This patch stabilizes several core concurrency macros, introduces async versions of
PathandPathBuf, and adds almost 100 other commits.Examples
Asynchronously read directories from the filesystem
use async_std::fs; use async_std::path::Path; use async_std::prelude::*; let path = Path::new("/laputa"); let mut dir = fs::read_dir(&path).await.unwrap(); while let Some(entry) = dir.next().await { if let Ok(entry) = entry { println!("{:?}", entry.path()); } }Cooperatively reschedule the current task on the executor
use async_std::prelude::*; use async_std::task; task::spawn(async { let x = fibonacci(1000); // Do expensive work task::yield_now().await; // Allow other tasks to run x + fibonacci(100) // Do more work })Create an interval stream
use async_std::prelude::*; use async_std::stream; use std::time::Duration; let mut interval = stream::interval(Duration::from_secs(4)); while let Some(_) = interval.next().await { println!("prints every four seconds"); }Added
- Added
FutureExtto theprelude, allowing us to extendFuture - Added
Stream::cmp - Added
Stream::ge - Added
Stream::last - Added
Stream::le - Added
Stream::lt - Added
Stream::mergeas "unstable", replacingstream::join! - Added
Stream::partial_cmp - Added
Stream::take_while - Added
Stream::try_fold - Added
future::IntoFutureas "unstable" - Added
io::BufRead::split - Added
io::Write::write_fmt - Added
print!,println!,eprint!,eprintln!macros as "unstable" - Added
processas "unstable", re-exporting std types only for now - Added
std::netre-exports to thenetsubmodule - Added
std::path::PathBufwith all associated methods - Added
std::path::Pathwith all associated methods - Added
stream::ExactSizeStreamas "unstable" - Added
stream::FusedStreamas "unstable" - Added
stream::Product - Added
stream::Sum - Added
stream::from_fn - Added
stream::intervalas "unstable" - Added
stream::repeat_with - Added
task::spawn_blockingas "unstable", replacingtask::blocking - Added
task::yield_now - Added
write!andwriteln!macros as "unstable" - Stabilized
future::join!andfuture::try_join! - Stabilized
future::timeout - Stabilized
path - Stabilized
task::ready!
Changed
- Fixed
BufWriter::into_innerso it callsflushbefore yielding - Refactored
io::BufWriterinternals - Refactored
net::ToSocketAddrsinternals - Removed Travis CI entirely
- Rewrote the README.md
- Stabilized
io::Cursor - Switched bors over to use GitHub actions
- Updated the
iodocumentation to match std'siodocs - Updated the
taskdocumentation to match std'sthreaddocs
Removed
- Removed the "unstable"
stream::join!in favor ofStream::merge - Removed the "unstable"
task::blockingin favor oftask::spawn_blocking
- Added
-
0.99.909 Oct 2019Release notes
Open source →This patch upgrades our
futures-rsversion, allowing us to build on the 1.39 beta. Additionally we've introducedmapandfor_eachtoStream. And we've added about a dozen newFromStreamimplementations forstdtypes, bringing us up to par with std'sFromIteratorimplementations.And finally we've added a new "unstable"
task::blockingfunction which can be used to convert blocking code into async code using a threadpool. We've been using this internally for a while now to async-std to power ourfsandnet::SocketAddrimplementations. With this patch userland code now finally has access to this too.Example
Create a stream of tuples, and collect into a hashmap
let a = stream::once(1u8); let b = stream::once(0u8); let s = a.zip(b); let map: HashMap<u8, u8> = s.collect().await; assert_eq!(map.get(&1), Some(&0u8));Spawn a blocking task on a dedicated threadpool
task::blocking(async { println!("long-running task here"); }).await;Added
- Added
stream::Stream::map - Added
stream::Stream::for_each - Added
stream::Stream::try_for_each - Added
task::blockingas "unstable" - Added
FromStreamfor allstd::{option, collections, result, string, sync}types. - Added the
pathsubmodule as "unstable".
Changed
- Updated
futures-previewto0.3.0-alpha.19, allowing us to build onrustc 1.39.0-beta. - As a consequence of this upgrade, all of our concrete stream implementations
now make use of
Stream::size_hintto optimize internal allocations. - We now use GitHub Actions through actions-rs, in addition to Travis CI. We intend to fully switch in the near future.
- Fixed a bug introduced in 0.99.6 where Unix Domain Listeners would sometimes become unresponsive.
- Updated our
sync::Barrierdocs to match std. - Updated our
stream::FromStreamdocs to match std'sFromIterator.
- Added
-
0.99.828 Sep 2019Release notes
Open source →Added
- Added README to examples directory.
- Added concurrency documentation to the futures submodule.
- Added
io::Read::takemethod. - Added
io::Read::by_refmethod. - Added
io::Read::chainmethod.
Changed
- Pin futures-preview to
0.3.0-alpha.18, to avoid rustc upgrade problems. - Simplified extension traits using a macro.
- Use the
broadcastmodule withstd::sync::Mutex, reducing dependencies.
-
0.99.726 Sep 2019Release notes
Open source →Added
- Added
future::joinmacro as "unstable" - Added
future::selectmacro as "unstable" - Added
future::try_joinmacro as "unstable" - Added
future::try_selectmacro as "unstable" - Added
io::BufWriterstruct - Added
stream::Extendtrait - Added
stream::Stream::chainmethod - Added
stream::Stream::filtermethod - Added
stream::Stream::inspectmethod - Added
stream::Stream::skip_whilemethod - Added
stream::Stream::skipmethod - Added
stream::Stream::step_bymethod - Added
sync::Arcstruct from stdlib - Added
sync::Barrierstruct as "unstable" - Added
sync::Weakstruct from stdlib - Added
task::readymacro as "unstable"
Changed
- Correctly marked the
pinsubmodule as "unstable" in the docs - Updated tutorial to have certain functions suffixed with
_loop iotraits are now re-exports of futures-rs types, allowing them to be implementedstreamtraits are now re-exports of futures-rs types, allowing them to be implementedprelude::*now needs to be in scope for functionsioandstreamtraits to work
- Added
-
0.99.619 Sep 2019Release notes
Open source →Added
- Added
stream::Stream::collectas "unstable" - Added
stream::Stream::enumerate - Added
stream::Stream::fuse - Added
stream::Stream::fold - Added
stream::Stream::scan - Added
stream::Stream::zip - Added
stream::joinmacro as "unstable" - Added
stream::DoubleEndedStreamas "unstable" - Added
stream::FromStreamtrait as "unstable" - Added
stream::IntoStreamtrait as "unstable" - Added
io::Cursoras "unstable" - Added
io::BufRead::consumemethod - Added
io::repeat - Added
io::Sliceandio::SliceMut - Added documentation for feature flags
- Added
pinsubmodule as "unstable" - Added the ability to
collecta stream ofResult<T, E>s into aResult<impl FromStream<T>, E>
Changed
- Refactored the scheduling algorithm of our executor to use work stealing
- Refactored the network driver, removing 400 lines of code
- Removed the
Sendbound fromtask::block_on - Removed
Unpinbound fromimpl<T: futures::stream::Stream> Stream for T
- Added
-
0.99.512 Sep 2019Release notes
Open source →Added
- Added tests for
io::timeout - Added
io::BufRead::fill_buf, anasync fncounterpart topoll_fill_buf - Added
fs::create_dir_all - Added
future::timeout, a free function to time out futures after a threshold - Added
io::prelude - Added
net::ToSocketAddrs, a non-blocking version of std'sToSocketAddrs - Added
stream::Stream::all - Added
stream::Stream::filter_map - Added
stream::Stream::find_map - Added
stream::Stream::find - Added
stream::Stream::min_by - Added
stream::Stream::nth
Changed
- Polished the text and examples of the tutorial
cargo fmton all examples- Simplified internals of
TcpStream::connect_to - Modularized our CI setup, enabled a rustfmt fallback, and improved caching
- Reduced our dependency on the
futures-rscrate, improving compilation times - Split
io::Read,io::Write,io::BufRead, andstream::Streaminto multiple files fs::Filenow flushes more often to prevent flushes duringseek- Updated all dependencies
- Fixed a bug in the conversion of
Fileinto raw handle - Fixed compilation errors on the latest nightly
Removed
- Added tests for
-
0.99.422 Aug 2019Release notes
Open source →Changes
- Many small changes in the book, mostly typos
- Documentation fixes correcting examples
- Now works with recent nightly with stabilised async/await (> 2019-08-21)
-
0.99.316 Aug 2019 -
0.99.216 Aug 2019Nothing published for this version
-
0.99.116 Aug 2019Nothing published for this version
-
0.99.016 Aug 2019Nothing published for this version
-
0.1.030 May 2019Nothing published for this version