#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RuleLookup {
NoRule,
NoKey,
NameOnly,
}
impl RuleLookup {
pub fn message(self, what: &str, id: &str) -> String {
match self {
RuleLookup::NoRule => format!("`{what}` names no rule `{id}`"),
RuleLookup::NoKey => format!("`{what}` names rule `{id}`, which captures no key"),
RuleLookup::NameOnly => format!(
"`{what}` names `{id}`, the `rule-id` of a unit rule, which holds no key: declare `key-of: {id}` on each rule whose keys it means, or name the `key-of` that the rule declares"
),
}
}
}