Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-08-23 01:46:58 +0300
committerGitHub <noreply@github.com>2018-08-23 01:46:58 +0300
commitddbbe48d56228fb8c5fc7c0e509da45fd7aa9efe (patch)
treeb12e6820d80266ca0321d6dd2d07320c0f1b8e99
parent987642ce467fdead5e3a6c95af57648b3d950ab6 (diff)
parent73eb575162e9bb0e910e53f17444a177e36735fc (diff)
DirEntry: add into_path method
This can avoid an allocation and copy in iterator chains that need to produce a PathBuf. PR #100
-rw-r--r--src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 58fc2e5..6ce95a3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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.
///