Releases: async-rs/async-std
v1.6.0
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) - Added an environment variable to configure the thread pool size of the runtime. (#774)
- Implement
CloneforUnixStream(#772)
Changed
- Switched underlying runtime to
smol. (#757) - Switched implementation of
sync::Barrierto usesync::Condvarlikestddoes. (#581) - For
wasm, switched underlyingTimerimplementation tofutures-timer. (#776)
Fixed
v1.5.0
This patch includes various quality of life improvements to async-std.
Including improved performance, stability, and the addition of various
Clone impls that replace the use of Arc in 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)
v1.4.0
This patch adds Future::timeout, providing a method counterpart to the
future::timeout free 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)
v1.3.0
This patch introduces Stream::delay, more methods on DoubleEndedStream,
and improves compile times. Stream::delay is a new API that's similar to
task::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)
v1.2.0
This patch includes some minor quality-of-life improvements, introduces a
new Stream::unzip API, 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 on master branch.
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.
v1.1.0
This patch introduces a faster scheduler algorithm, Stream::throttle, and
stabilizes task::yield_now. Additionally we're introducing several more stream
APIs, bringing us to almost complete parity with the standard library.
Furthermore our path submodule 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(3);
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 thechannel
function.
v1.0.1
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.
v1.0.0
This release marks the 1.0.0 release 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 the major number.
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.
v0.99.12
This patch upgrades us to futures 0.3, support for async/await on 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).
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.