mirror of
https://github.com/async-rs/async-std.git
synced 2025-02-06 20:55:33 +00:00
Implemented Path::join
This commit is contained in:
parent
0c03b92373
commit
cc57db02a3
1 changed files with 21 additions and 0 deletions
|
@ -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…
Reference in a new issue