diff options
author | Ruud van Asseldonk <dev@veniogames.com> | 2018-04-10 00:35:43 +0300 |
---|---|---|
committer | Ruud van Asseldonk <dev@veniogames.com> | 2018-04-10 00:38:40 +0300 |
commit | 73eb575162e9bb0e910e53f17444a177e36735fc (patch) | |
tree | 66a9fdc496bee4dbd7b3bf9d0c0986720ca73e00 | |
parent | 26dc0f584b06c6f53f71e151e8f3bb96a2a1d46a (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.rs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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. /// |