pub struct Rule {
pub id: &'static str,
pub when: &'static [Condition],
pub setting: &'static str,
pub expect: Test,
pub default: Value,
pub unit: Unit,
pub strength: Strength,
pub basis: Basis,
pub reason: &'static str,
pub source: &'static str,
}Expand description
A rule: when Self::when holds, Self::setting should pass Self::expect.
Serialised with every field and its Kind ("kind", from the strength).
Fields§
§id: &'static strStable identifier, <method>.<what> in kebab case.
when: &'static [Condition]Conditions, all of which must hold. The first is the triggering choice the rule is scoped to (see the module docs).
setting: &'static strThe setting the rule is about (a path in SETTINGS).
expect: TestWhat the setting should pass.
default: ValueThe value to apply to resolve the finding (one that passes expect).
unit: UnitUnit of default and of any range in expect.
strength: Strength§basis: BasisWhat the rule rests on: a statement by the authors, a QSM.rs measurement, the reference’s choice, or QSM.rs’s implementation.
reason: &'static strOne line: why.
source: &'static strThe authors’ code (file, line) or paper (section), or the QSM.rs docs recording the measurement.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
The original authors’ setting, or a reasoned recommendation (Strength::kind).
Sourcepub fn needs_scan(&self) -> bool
pub fn needs_scan(&self) -> bool
Whether the rule can only fire once the scan is known.
Trait Implementations§
impl Copy for Rule
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more