diff options
Diffstat (limited to 'src/atom/mod.rs')
| -rw-r--r-- | src/atom/mod.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/atom/mod.rs b/src/atom/mod.rs index ffb9c61..eb7537b 100644 --- a/src/atom/mod.rs +++ b/src/atom/mod.rs @@ -106,15 +106,23 @@ pub struct UseDep { #[derive(Clone, Debug, Get)] pub struct Atom { blocker: Option<Blocker>, - version_operator: Option<VersionOperator>, category: Category, name: Name, - version: Option<Version>, + version: Option<(VersionOperator, Version)>, slot: Option<Slot>, #[get(kind = "deref")] usedeps: Vec<UseDep>, } +impl Atom { + pub fn version_operator(&self) -> Option<VersionOperator> { + match self.version { + Some((operator, _)) => Some(operator), + None => None, + } + } +} + impl fmt::Display for Blocker { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -299,7 +307,7 @@ impl fmt::Display for Atom { write!(f, "{blocker}")?; } - if let Some(version_operator) = self.version_operator.as_ref() { + if let Some(version_operator) = self.version_operator().as_ref() { write!(f, "{version_operator}")?; } @@ -307,7 +315,7 @@ impl fmt::Display for Atom { write!(f, "/")?; write!(f, "{}", self.name)?; - if let Some(version) = self.version.as_ref() { + if let Some((_, version)) = self.version.as_ref() { write!(f, "-{version}")?; } |
