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:
authorRuud van Asseldonk <dev@veniogames.com>2018-04-10 00:35:43 +0300
committerRuud van Asseldonk <dev@veniogames.com>2018-04-10 00:38:40 +0300
commit73eb575162e9bb0e910e53f17444a177e36735fc (patch)
tree66a9fdc496bee4dbd7b3bf9d0c0986720ca73e00
parent26dc0f584b06c6f53f71e151e8f3bb96a2a1d46a (diff)
add DirEntry::into_path
This can avoid an allocation and copy in iterator chains that need to produce a PathBuf.
-rw-r--r--src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9d20478..8c8774d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -968,6 +968,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.
///