pub struct RuleId { /* private fields */ }Expand description
A namespaced rule identifier, such as lanekeep/no-default-export.
Construct one by parsing: "local/no-numeric-sizes".parse::<RuleId>().
Implementations§
Source§impl RuleId
impl RuleId
Sourcepub fn is_built_in(&self) -> bool
pub fn is_built_in(&self) -> bool
Whether this is a rule shipped with lanekeep.
Sourcepub fn new(namespace: Namespace, name: &str) -> Result<Self, ParseRuleIdError>
pub fn new(namespace: Namespace, name: &str) -> Result<Self, ParseRuleIdError>
Build an ID from parts, validating the name.
§Errors
Returns ParseRuleIdError when the name is empty or not in the required form.
Sourcepub fn namespace_from_str(
namespace: &str,
) -> Result<Namespace, ParseRuleIdError>
pub fn namespace_from_str( namespace: &str, ) -> Result<Namespace, ParseRuleIdError>
A namespace from its written form, validating its shape.
§Errors
Returns ParseRuleIdError when it is empty or not lowercase kebab-case.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RuleId
impl<'de> Deserialize<'de> for RuleId
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for RuleId
Source§impl Ord for RuleId
Ordering is over the rendered string, not over (Namespace, name).
impl Ord for RuleId
Ordering is over the rendered string, not over (Namespace, name).
The distinction matters because violations are sorted by (ruleId, file, line, column)
and that order is part of lanekeep’s output contract. Deriving Ord would order by the
Namespace enum’s declaration order, so adding a variant — say, one sorting between the
existing two — would silently reorder every report without any output-producing code
changing. Comparing rendered strings is stable against that, and is also the order a
reader expects from looking at the output.