pub struct Enforcement {
pub mode: Mode,
pub validator: Option<String>,
pub category: Option<String>,
pub exit_code: Option<i64>,
pub enforced_by: Option<String>,
pub tests: Vec<String>,
pub reviewed_because: Option<String>,
}Expand description
The enforcement block of a rule, read from x-majordomus.
§Example
Read from front matter rather than built by hand; this is the shape a gated rule produces, and the mode is decided by what the block actually names.
use majordomus_cli::rules::{Enforcement, Mode};
let e = Enforcement {
mode: Mode::Gated,
validator: None,
category: None,
exit_code: None,
enforced_by: None,
tests: vec!["test/cases/07_scope.sh".into()],
reviewed_because: None,
};
assert_eq!(e.mode, Mode::Gated);Fields§
§mode: ModeWhich of the two canonical modes, or neither.
validator: Option<String>The validator the dispatcher calls, when the mode is dispatched.
category: Option<String>The diagnostic category the validator reports under.
exit_code: Option<i64>The exit code the validator uses to refuse.
enforced_by: Option<String>Which boundary enforces it: the word the rule’s own block uses.
tests: Vec<String>Every test the block names, in the order it names them.
reviewed_because: Option<String>Why nothing executable can express this rule, when the mode is reviewed. Required there: a declared exemption with no reason is the debt it exists to replace.
Trait Implementations§
Source§impl Clone for Enforcement
impl Clone for Enforcement
Source§fn clone(&self) -> Enforcement
fn clone(&self) -> Enforcement
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Enforcement
impl Debug for Enforcement
Source§impl<'de> Deserialize<'de> for Enforcement
impl<'de> Deserialize<'de> for Enforcement
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 Enforcement
Source§impl JsonSchema for Enforcement
impl JsonSchema for Enforcement
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for Enforcement
impl PartialEq for Enforcement
Source§fn eq(&self, other: &Enforcement) -> bool
fn eq(&self, other: &Enforcement) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Enforcement
impl Serialize for Enforcement
impl StructuralPartialEq for Enforcement
Auto Trait Implementations§
impl Freeze for Enforcement
impl RefUnwindSafe for Enforcement
impl Send for Enforcement
impl Sync for Enforcement
impl Unpin for Enforcement
impl UnsafeUnpin for Enforcement
impl UnwindSafe for Enforcement
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.