forked from gentoo-utils/gentoo-utils
represent 4th variant of slots, and disallow empty primary slot names
This commit is contained in:
@@ -85,8 +85,9 @@ pub struct SlotName(#[get(method = "name", kind = "deref")] String);
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Slot {
|
||||
Wildcard,
|
||||
Equal {
|
||||
primary: Option<SlotName>,
|
||||
Equal,
|
||||
NameEqual {
|
||||
primary: SlotName,
|
||||
sub: Option<SlotName>,
|
||||
},
|
||||
Name {
|
||||
@@ -592,10 +593,11 @@ impl fmt::Display for Slot {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Wildcard => write!(f, "*"),
|
||||
Self::Equal { primary, sub } => {
|
||||
if let Some(primary) = primary {
|
||||
write!(f, "{primary}")?;
|
||||
}
|
||||
Self::Equal => {
|
||||
write!(f, "=")
|
||||
}
|
||||
Self::NameEqual { primary, sub } => {
|
||||
write!(f, "{primary}")?;
|
||||
|
||||
if let Some(sub) = sub {
|
||||
write!(f, "/{sub}")?;
|
||||
|
||||
Reference in New Issue
Block a user