pub struct RuleDefinition {Show 14 fields
pub id: String,
pub identity: String,
pub uri: String,
pub version: u64,
pub title: String,
pub description: Option<String>,
pub statement: Option<String>,
pub status: String,
pub class: Class,
pub namespace: String,
pub depends_on: Vec<String>,
pub tags: Vec<String>,
pub path: String,
pub enforcement: Enforcement,
}Expand description
One rule, as the repository canonically declares it.
§Example
Built by definitions from the index rather than by hand. Its ordering is the one
the crate has, so a report over the same tree reads the same twice.
use majordomus_cli::rules::{Class, RuleDefinition};
let d = RuleDefinition {
id: "project.scope-is-declared".into(),
identity: "project.scope-is-declared@1".into(),
uri: "majordomus://rule/project.scope-is-declared@1".into(),
version: 1,
title: "Scope is declared".into(),
description: None,
statement: None,
status: "active".into(),
class: Class::Blocking,
namespace: "project".into(),
depends_on: vec![],
tags: vec![],
path: ".ai/repo/rules/project/scope-is-declared.v1.md".into(),
enforcement: Enforcement {
mode: Mode::Declarative, validator: None, category: None, exit_code: None,
enforced_by: None, tests: vec![], reviewed_because: None,
},
};
assert_eq!(d.class, Class::Blocking);Fields§
§id: StringThe rule id, <namespace>.<stem>, without the version.
identity: StringThe identity the index holds, with the version.
uri: Stringmajordomus://rule/<identity>.
version: u64The declared version.
title: StringThe title.
description: Option<String>The one-line description.
statement: Option<String>The normative sentence.
status: Stringactive, or whatever else the front matter declares.
class: ClassHow strongly it binds.
namespace: StringWhether it came with the vendored package or belongs to this project.
depends_on: Vec<String>The rules it depends on, by id.
The declared tags.
path: StringRepository-relative path of the rule object.
enforcement: EnforcementHow it is enforced, as declared.
Trait Implementations§
Source§impl Clone for RuleDefinition
impl Clone for RuleDefinition
Source§fn clone(&self) -> RuleDefinition
fn clone(&self) -> RuleDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuleDefinition
impl Debug for RuleDefinition
Source§impl<'de> Deserialize<'de> for RuleDefinition
impl<'de> Deserialize<'de> for RuleDefinition
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>,
impl Eq for RuleDefinition
Source§impl JsonSchema for RuleDefinition
impl JsonSchema for RuleDefinition
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ordered for RuleDefinition
A rule is ordered by its namespace, then by what a reader reads, then by its id — so
that the vendored package and the project’s own rules stay in their blocks and the
sequence is total whatever order discovery handed them.
impl Ordered for RuleDefinition
A rule is ordered by its namespace, then by what a reader reads, then by its id — so that the vendored package and the project’s own rules stay in their blocks and the sequence is total whatever order discovery handed them.
Source§impl PartialEq for RuleDefinition
impl PartialEq for RuleDefinition
Source§fn eq(&self, other: &RuleDefinition) -> bool
fn eq(&self, other: &RuleDefinition) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RuleDefinition
impl Serialize for RuleDefinition
impl StructuralPartialEq for RuleDefinition
Auto Trait Implementations§
impl Freeze for RuleDefinition
impl RefUnwindSafe for RuleDefinition
impl Send for RuleDefinition
impl Sync for RuleDefinition
impl Unpin for RuleDefinition
impl UnsafeUnpin for RuleDefinition
impl UnwindSafe for RuleDefinition
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<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
key and return true if they are equal.