Skip to main content

RuleProse

Struct RuleProse 

Source
pub struct RuleProse {
    pub severity_rationale: String,
    pub likely_cause: Option<String>,
    pub likely_cause_template: Option<String>,
    pub likely_cause_template_with_field: Option<String>,
    pub likely_cause_template_no_field: Option<String>,
    pub hypotheses: Vec<String>,
    pub unknowns: Vec<String>,
    pub next_steps: Vec<String>,
    pub escalation_note: String,
}
Expand description

Per-rule prose entry.

likely_cause and the three likely_cause_template_* fields are all Option; each rule arm uses exactly one of them depending on whether it needs to interpolate a placeholder. The every_rule_template_kind_matches_its_call_site test pins which variant each rule is expected to populate.

Fields§

§severity_rationale: String§likely_cause: Option<String>§likely_cause_template: Option<String>§likely_cause_template_with_field: Option<String>§likely_cause_template_no_field: Option<String>§hypotheses: Vec<String>§unknowns: Vec<String>§next_steps: Vec<String>§escalation_note: String

Implementations§

Source§

impl RuleProse

Source

pub fn likely_cause_static(&self) -> &str

Static likely-cause text for rules that don’t interpolate fields.

Source

pub fn likely_cause_with_host(&self, host: &str) -> String

Likely-cause text with {host} substituted.

Source

pub fn likely_cause_with_peer(&self, peer: &str) -> String

Likely-cause text with {peer} substituted.

Source

pub fn likely_cause_with_optional_field(&self, field: Option<&str>) -> String

Likely-cause text for bad_payload-style rules where the validated field may or may not be present. Picks the right template and substitutes {field} when applicable.

Trait Implementations§

Source§

impl Debug for RuleProse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RuleProse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,