summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-11-15 00:10:12 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-11-15 00:10:55 +0000
commitdfaad015b9fea7c3366dd2c453621c3bf161a3c9 (patch)
treead44af1e36c67297499930472076bd6d8e251ca3
parent9c7d38f82ca1f546e01f6890c7939a7737786261 (diff)
downloadgentoo-utils-dfaad015b9fea7c3366dd2c453621c3bf161a3c9.tar.gz
impl conversion methods for Atom and Cp
-rw-r--r--src/atom/mod.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/atom/mod.rs b/src/atom/mod.rs
index 6f53f0e..2ecf655 100644
--- a/src/atom/mod.rs
+++ b/src/atom/mod.rs
@@ -133,6 +133,15 @@ pub struct Atom {
usedeps: Vec<UseDep>,
}
+impl Cpv {
+ pub fn into_cp(self) -> Cp {
+ Cp {
+ name: self.name,
+ category: self.category,
+ }
+ }
+}
+
impl Atom {
pub fn version_operator(&self) -> Option<VersionOperator> {
match self.version {
@@ -140,6 +149,25 @@ impl Atom {
None => None,
}
}
+
+ pub fn into_cp(self) -> Cp {
+ Cp {
+ category: self.category,
+ name: self.name,
+ }
+ }
+
+ pub fn into_cpv(self) -> Option<Cpv> {
+ match self.version {
+ Some((_, version)) => Some(Cpv {
+ category: self.category,
+ name: self.name,
+ version,
+ slot: self.slot,
+ }),
+ None => None,
+ }
+ }
}
impl PartialEq for VersionSuffix {