Implemented Path::join

yoshuawuyts-patch-1
Wouter Geraedts 5 years ago
parent 0c03b92373
commit cc57db02a3

@ -415,6 +415,27 @@ impl Path {
self.inner.iter()
}
/// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
///
/// See [`PathBuf::push`] for more details on what it means to adjoin a path.
///
/// [`PathBuf`]: struct.PathBuf.html
/// [`PathBuf::push`]: struct.PathBuf.html#method.push
///
/// # Examples
///
/// ```
/// use async_std::path::{Path, PathBuf};
///
/// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
/// ```
pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf
where
P: std::convert::AsRef<std::path::Path>,
{
self.inner.join(path).into()
}
/// Queries the file system to get information about a file, directory, etc.
///
/// This function will traverse symbolic links to query information about the

Loading…
Cancel
Save