allow Cpv type to have a slot

This commit is contained in:
John Turner
2025-11-13 19:57:28 +00:00
parent 0448a52926
commit 36bdbbd8bc
2 changed files with 18 additions and 2 deletions

View File

@@ -119,6 +119,7 @@ pub struct Cpv {
category: Category,
name: Name,
version: Version,
slot: Option<Slot>,
}
#[derive(Clone, Debug, Get, PartialEq, Eq)]
@@ -572,7 +573,13 @@ impl fmt::Display for Cp {
impl fmt::Display for Cpv {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}/{}-{}", &self.category, &self.name, &self.version)
write!(f, "{}/{}-{}", &self.category, &self.name, &self.version)?;
if let Some(slot) = self.slot.as_ref() {
write!(f, ":{slot}")?;
}
Ok(())
}
}