async-rs/async-std

Question about async_std::fs::ReadDir

PHSix opened this issue · 2 comments

PHSix commented

I am a new user for async-std. Recently I want to wirte a program with rust asycn-std crate to achieve get all files under a directory. But I found that the ReadDir struct have no public methods to get DirEntry struct(Actually it have no public method.). At the same time, I found a example about use async_std::fs::DirEntry in docs.rs:
image
In this example, it use next method of async_std::fs::ReadDir struct. But actually the next method of async_std::fs::ReadDir struct is private.

jbr commented

ReadDir is Stream, and it is Stream's next that the example uses for async iteration. You'll need to use async_std::stream::Stream in order to use it, which is included in the async_std prelude

PHSix commented

ReadDir is Stream, and it is Stream's next that the example uses for async iteration. You'll need to use async_std::stream::Stream in order to use it, which is included in the async_std prelude

Oh, thanks for your reply. I know where I take a mistake. Thanks for you again😎.