From 73eb575162e9bb0e910e53f17444a177e36735fc Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Mon, 9 Apr 2018 23:35:43 +0200 Subject: add DirEntry::into_path This can avoid an allocation and copy in iterator chains that need to produce a PathBuf. --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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. /// -- cgit v1.2.3