summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-08-24 11:56:30 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-08-26 12:30:24 +0200
commit18146a9ca0b818788136d8847434c49bfd92d8e2 (patch)
tree34a1360b99acbd73324a98fd0d16b156f4ac5d8e
parent683c59c3576857b8bbfde08bf5213b07aadc0018 (diff)
Add PathComponent::dir_name() helper fn
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/repository/fs.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/repository/fs.rs b/src/repository/fs.rs
index a9a1e65..26570ce 100644
--- a/src/repository/fs.rs
+++ b/src/repository/fs.rs
@@ -70,6 +70,13 @@ impl PathComponent {
fn is_pkg_toml(&self) -> bool {
std::matches!(self, PathComponent::PkgToml)
}
+
+ fn dir_name(&self) -> Option<&str> {
+ match self {
+ PathComponent::PkgToml => None,
+ PathComponent::DirName(dn) => Some(dn)
+ }
+ }
}