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