Closed

Description
The std::path::Path
struct has some blocking methods like read_dir
which should be asynchronous in our library.
That means we'll need to have our own async_std::path::Path
that is convertible to/from std::path::Path
. Moreover, since PathBuf
derefs into Path
, we'll also need an async version of PathBuf
.
Right now, we're using std::path::Path
throughout async-std
, which might cause users to accidentally call blocking functions without realizing. For example:
let mut dir = fs::read_dir(".").await?;
while let Some(entry) = dir.next().await {
let path = entry?.path();
// Ooops, the `path.canonicalize()` call here is blocking!
//
// We should use an async version of `PathBuf` here and
// do `path.canonicalize().await` instead.
println!("{:?}", path.canonicalize()?);
}
Tasks
PathBuf
-
path::PathBuf::as_path
-
path::PathBuf::capacity
-
path::PathBuf::clear
-
path::PathBuf::into_boxed_path
-
path::PathBuf::into_os_string
-
path::PathBuf::new
-
path::PathBuf::pop
-
path::PathBuf::push
-
path::PathBuf::reserve
-
path::PathBuf::reserve_exact
-
path::PathBuf::set_extension
-
path::PathBuf::set_file_name
-
path::PathBuf::shrink_to
-
path::PathBuf::shrink_to_fit
-
path::PathBuf::with_capacity
-
impl<P: AsRef<Path>> FromStream<P> for PathBuf
Path
-
path::Path::ancestors
-
path::Path::as_os_str
-
path::Path::canonicalize
-
path::Path::components
-
path::Path::display
-
path::Path::ends_with
-
path::Path::exists
-
path::Path::extension
-
path::Path::file_name
-
path::Path::file_stem
-
path::Path::has_root
-
path::Path::into_path_buf
-
path::Path::is_absolute
-
path::Path::is_dir
-
path::Path::is_file
-
path::Path::is_relative
-
path::Path::iter
-
path::Path::join
-
path::Path::metadata
-
path::Path::new
-
path::Path::parent
-
path::Path::read_dir
-
path::Path::read_link
-
path::Path::starts_with
-
path::Path::strip_prefix
-
path::Path::symlink_metadata
-
path::Path::to_path_buf
-
path::Path::to_str
-
path::Path::to_string_lossy
-
path::Path::with_extension
-
path::Path::with_file_name