mirror of
https://github.com/BurntSushi/walkdir.git
synced 2025-10-03 00:14:27 +00:00
DirEntry: add into_path method
This can avoid an allocation and copy in iterator chains that need to produce a PathBuf. PR #100
This commit is contained in:
commit
ddbbe48d56
@ -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.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user