Releases: async-rs/async-std
v0.99.10
This patch stabilizes several core concurrency macros, introduces async versions
of Path and PathBuf, 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 = fibonnacci(1000); // Do expensive work
task::yield_now().await; // Allow other tasks to run
x + fibonnacci(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
v0.99.9
This patch upgrades our futures-rs version, allowing us to build on the 1.39
beta. Additionally we've introduced map and for_each to Stream. And we've
added about a dozen new FromStream implementations for std types, bringing
us up to par with std's FromIterator implementations.
And finally we've added a new "unstable" task::blocking function 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 our fs and
net::SocketAddr implementations. 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 ofStream::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.
v0.99.8
This release came slightly ahead of schedule in order to fix compatibility issues with the newly released [email protected] and Rust 1.39 beta release. Additionally we've introduced documentation for futures concurrency, and several new io::Read methods!
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.
v0.99.7
This release includes 16 new APIs, including new streams combinators, Futures concurrency macros, and extensions to the sync and io submodules.
example using future::join
use async_std::future;
let a = future::ready(1);
let b = future::ready(2);
let c = future::ready(3);
let f = future::join!(a, b, c);
assert_eq!(f.await, (1, 2, 3));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
v0.99.6
This release adds several new combinators, a work-stealing executor, and the ability to collect streams using IntoStream and FromStream.
Additionally async-attributes 1.0 has been released which adds support for async fn main, #[test] async fn, and #[bench] async fn.
Example
let a = stream::once(1u8);
let b = stream::once(2u8);
let c = stream::once(3u8);
let s = stream::join!(a, b, c);
assert_eq!(s.collect().await, vec![1u8, 2u8, 3u8]));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 a
Result<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
v0.99.5
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