forked from gentoo-utils/gentoo-utils
impl conversion methods for Atom and Cp
This commit is contained in:
@@ -133,6 +133,15 @@ pub struct Atom {
|
|||||||
usedeps: Vec<UseDep>,
|
usedeps: Vec<UseDep>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Cpv {
|
||||||
|
pub fn into_cp(self) -> Cp {
|
||||||
|
Cp {
|
||||||
|
name: self.name,
|
||||||
|
category: self.category,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Atom {
|
impl Atom {
|
||||||
pub fn version_operator(&self) -> Option<VersionOperator> {
|
pub fn version_operator(&self) -> Option<VersionOperator> {
|
||||||
match self.version {
|
match self.version {
|
||||||
@@ -140,6 +149,25 @@ impl Atom {
|
|||||||
None => None,
|
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 {
|
impl PartialEq for VersionSuffix {
|
||||||
|
|||||||
Reference in New Issue
Block a user