pub struct RuleRegistry {
pub rule_schemas: BTreeMap<String, Map<String, Value>>,
pub rule_aliases: BTreeMap<String, HashMap<String, String>>,
}Expand description
Registry of all known rules and their config schemas
Fields§
§rule_schemas: BTreeMap<String, Map<String, Value>>Map of rule name (e.g. “MD013”) to set of valid config keys and their TOML value types
rule_aliases: BTreeMap<String, HashMap<String, String>>Map of rule name to config key aliases
Implementations§
Source§impl RuleRegistry
impl RuleRegistry
Sourcepub fn from_rules(rules: &[Box<dyn Rule>]) -> Self
pub fn from_rules(rules: &[Box<dyn Rule>]) -> Self
Build a registry from a list of rules
Sourcepub fn rule_names(&self) -> BTreeSet<String>
pub fn rule_names(&self) -> BTreeSet<String>
Get all known rule names
Sourcepub fn config_keys_for(&self, rule: &str) -> Option<BTreeSet<String>>
pub fn config_keys_for(&self, rule: &str) -> Option<BTreeSet<String>>
Get the valid configuration keys for a rule, including both original and normalized variants
Sourcepub fn canonical_config_key(&self, rule: &str, key: &str) -> Option<&str>
pub fn canonical_config_key(&self, rule: &str, key: &str) -> Option<&str>
Resolve a key as the user wrote it to the schema key it names, trying the rule’s aliases and the separator/case variants.
Returns None when the rule does not accept the key at all. A key that resolves
may still carry a sentinel value, so this answers “is this key known?” where
RuleRegistry::expected_value_for answers “what type must it be?”.
Sourcepub fn expected_value_for(&self, rule: &str, key: &str) -> Option<&Value>
pub fn expected_value_for(&self, rule: &str, key: &str) -> Option<&Value>
Get the expected value type for a rule’s configuration key, trying variants.
Returns None both for an unknown key and for sentinel values (nullable Option
fields, polymorphic fields that accept multiple TOML types), which signals the
caller to skip type checking while still recognizing the key as valid. Use
RuleRegistry::canonical_config_key to tell those two cases apart.
Sourcepub fn resolve_rule_name(&self, name: &str) -> Option<String>
pub fn resolve_rule_name(&self, name: &str) -> Option<String>
Resolve any rule name (canonical or alias) to its canonical form Returns None if the rule name is not recognized
Resolution order:
- Direct canonical name match
- Static aliases (built-in markdownlint aliases)