DirEntry: add into_path method

This can avoid an allocation and copy in iterator chains that need to
produce a PathBuf.

PR #100
This commit is contained in:
Andrew Gallant 2018-08-22 18:46:58 -04:00 committed by GitHub
commit ddbbe48d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -971,6 +971,15 @@ impl DirEntry {
&self.path
}
/// The full path that this entry represents.
///
/// Analogous to [`path`], but moves ownership of the path.
///
/// [`path`]: struct.DirEntry.html#method.path
pub fn into_path(self) -> PathBuf {
self.path
}
/// Returns `true` if and only if this entry was created from a symbolic
/// link. This is unaffected by the [`follow_links`] setting.
///