From e9603ce62ff9c53102c5e78375102aa031e433cb Mon Sep 17 00:00:00 2001 From: John Turner Date: Sat, 22 Nov 2025 01:03:14 +0000 Subject: represent 4th variant of slots, and disallow empty primary slot names --- src/atom/mod.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/atom/mod.rs') diff --git a/src/atom/mod.rs b/src/atom/mod.rs index 82cef15..0b31223 100644 --- a/src/atom/mod.rs +++ b/src/atom/mod.rs @@ -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, + Equal, + NameEqual { + primary: SlotName, sub: Option, }, 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}")?; -- cgit v1.2.3