diff options
author | Andrew Gallant <jamslam@gmail.com> | 2018-08-23 01:46:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-23 01:46:58 +0300 |
commit | ddbbe48d56228fb8c5fc7c0e509da45fd7aa9efe (patch) | |
tree | b12e6820d80266ca0321d6dd2d07320c0f1b8e99 | |
parent | 987642ce467fdead5e3a6c95af57648b3d950ab6 (diff) | |
parent | 73eb575162e9bb0e910e53f17444a177e36735fc (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.rs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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. /// |