mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 05:33:04 +02:00
ignore: add into_path for DirEntry (#1031)
This commit adds ignore::DirEntry::into_path to match the corresponding method on walkdir::DirEntry.
This commit is contained in:
parent
8f978a3cf7
commit
d18839f3dc
@ -36,6 +36,14 @@ impl DirEntry {
|
|||||||
self.dent.path()
|
self.dent.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.dent.into_path()
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this entry corresponds to a symbolic link or not.
|
/// Whether this entry corresponds to a symbolic link or not.
|
||||||
pub fn path_is_symlink(&self) -> bool {
|
pub fn path_is_symlink(&self) -> bool {
|
||||||
self.dent.path_is_symlink()
|
self.dent.path_is_symlink()
|
||||||
@ -144,6 +152,15 @@ impl DirEntryInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn into_path(self) -> PathBuf {
|
||||||
|
use self::DirEntryInner::*;
|
||||||
|
match self {
|
||||||
|
Stdin => PathBuf::from("<stdin>"),
|
||||||
|
Walkdir(x) => x.into_path(),
|
||||||
|
Raw(x) => x.into_path(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn path_is_symlink(&self) -> bool {
|
fn path_is_symlink(&self) -> bool {
|
||||||
use self::DirEntryInner::*;
|
use self::DirEntryInner::*;
|
||||||
match *self {
|
match *self {
|
||||||
@ -262,6 +279,10 @@ impl DirEntryRaw {
|
|||||||
&self.path
|
&self.path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn into_path(self) -> PathBuf {
|
||||||
|
self.path
|
||||||
|
}
|
||||||
|
|
||||||
fn path_is_symlink(&self) -> bool {
|
fn path_is_symlink(&self) -> bool {
|
||||||
self.ty.is_symlink() || self.follow_link
|
self.ty.is_symlink() || self.follow_link
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user