From f54534cc379965502ca40c6de050a98232429cba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 15 Sep 2022 15:09:15 +0200 Subject: [PATCH] release: add 'architecture' helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit which returns if a file reference is architecture specific, and for which architecture it is relevant. Signed-off-by: Fabian Grünbichler --- src/deb822/release_file.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/deb822/release_file.rs b/src/deb822/release_file.rs index 2b7245b..5888728 100644 --- a/src/deb822/release_file.rs +++ b/src/deb822/release_file.rs @@ -228,6 +228,22 @@ impl FileReferenceType { } } + pub fn architecture(&self) -> Option<&Architecture> { + match self { + FileReferenceType::Commands(arch, _) + | FileReferenceType::Contents(arch, _) + | FileReferenceType::ContentsUdeb(arch, _) + | FileReferenceType::Packages(arch, _) => Some(arch), + FileReferenceType::PseudoRelease(arch) => arch.as_ref(), + FileReferenceType::Unknown + | FileReferenceType::PDiff + | FileReferenceType::Sources(_) + | FileReferenceType::Dep11(_) + | FileReferenceType::Translation(_) + | FileReferenceType::Ignored => None, + } + } + pub fn is_package_index(&self) -> bool { matches!(self, FileReferenceType::Packages(_, _)) } -- 2.39.2