I'm trying to read a directory using async I/O in tokio
. This is as close as I've got:
async fn read_dir() -> std::io::Result<()> {
let mut reader = tokio::fs::read_dir("dir_name").await?;
loop {
if let Some(f) = reader.next().await? {
// TODO
} else {
break;
}
}
Ok(())
}
The compiler error says that tokio::ReadDir
does not satisfy the trait bound ReadDir : Stream
, but there is such an implementation here, so I'm baffled.
Any help appreciated.