pub struct RuleCard {
pub message: String,
pub remediation: String,
pub examples: Examples,
}Expand description
Everything a reader — human or model — needs to act on a violation.
Fields§
§message: StringOne line saying what is wrong. Not what to do about it.
remediation: StringWhat to do instead. Specific enough to act on without reading the rule source.
examples: ExamplesA bad/good pair.
Implementations§
Source§impl RuleCard
impl RuleCard
Sourcepub fn validate(&self) -> Result<(), Vec<CardProblem>>
pub fn validate(&self) -> Result<(), Vec<CardProblem>>
Check that the card can actually do its job.
This is deliberately more than a null check. A card is the tool’s output, and an empty remediation produces a violation a reader cannot act on — which is indistinguishable, from their side, from lanekeep being wrong.
§Errors
Returns every problem found, so a rule author fixes them in one pass rather than one per run.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RuleCard
impl<'de> Deserialize<'de> for RuleCard
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RuleCard
impl StructuralPartialEq for RuleCard
Auto Trait Implementations§
impl Freeze for RuleCard
impl RefUnwindSafe for RuleCard
impl Send for RuleCard
impl Sync for RuleCard
impl Unpin for RuleCard
impl UnsafeUnpin for RuleCard
impl UnwindSafe for RuleCard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more