Skip to main content

ConstraintDef

Enum ConstraintDef 

Source
pub enum ConstraintDef {
    RequiresWhen {
        field: String,
        when_field: String,
        when_value: String,
        severity: ConstraintSeverity,
    },
    Unique {
        fields: Vec<String>,
        severity: ConstraintSeverity,
    },
    EnumFromNeighbour {
        field: String,
        rel_type: String,
        section: String,
        severity: ConstraintSeverity,
    },
    StatusPropagation {
        field: String,
        value: String,
        rel_type: String,
        direction: PropagationDirection,
        severity: ConstraintSeverity,
    },
}
Expand description

One declared keep-health constraint on a type — the constraint vocabulary (agent-toolbox plan 07). Declarations travel sealed with the schema package and are rendered on the memstead_schema response at BOTH verbosity levels (a hidden legality condition is a defect class of its own). The kind tag is closed: an unknown kind fails deserialization, so no declaration can load and be silently ignored. Forms land vertically — a form is only declarable once the engine evaluates it.

Variants§

§

RequiresWhen

Form 1 — conditional requirement: field (a metadata field or section key of this type) is required whenever when_field holds when_value (“status: checked requires checked_by”).

Fields

§field: String

The field or section that becomes required.

§when_field: String

The metadata field whose value triggers the requirement.

§when_value: String

The triggering value (validated against when_field’s enum, when it declares one).

§

Unique

Form 2 — uniqueness: the tuple of metadata-field values named in fields is unique among entities of this type within one mem. Entities missing any of the fields carry no tuple and are not compared. Defaults to block — the whole point of the declaration is preventing the duplicate at write time.

Fields

§fields: Vec<String>

The metadata fields forming the unique tuple (each must be a declared metadata field of this type).

§

EnumFromNeighbour

Form 3 — enum-from-neighbour: the legal values of field are the bullet-list entries (- value lines) of the section section on the entity reached from this one via a rel_type edge. A set value with no backing entry in any reached neighbour’s section — including the no-neighbour and missing-section cases, where nothing can back it — is a violation.

Fields

§field: String

The metadata field whose values the neighbour enumerates.

§rel_type: String

The outgoing rel-type that reaches the enumerating entity.

§section: String

The section key on the reached entity whose bullet entries are the legal values.

§

StatusPropagation

Form 5 — status propagation: when field on an entity of this type holds value (the terminal value), every entity reaching it — transitively — via rel_type edges in direction is tainted; tainted entities surface as health findings naming their tainting ancestor. Always warn-tier: the taint arises from the ancestor’s later change, so it can never refuse the descendant’s historical write (the loader refuses a block declaration on this form rather than accepting a promise the engine will not keep).

Fields

§field: String

The status metadata field on this (the tainting) type.

§value: String

The terminal value that starts the taint (validated against field’s enum, when it declares one).

§rel_type: String

The rel-type the taint travels along.

§direction: PropagationDirection

Which direction reaches the dependents: incoming taints the entities whose rel_type edges point at the terminal entity (and their dependents, transitively); outgoing the entities the terminal entity points at.

Trait Implementations§

Source§

impl Clone for ConstraintDef

Source§

fn clone(&self) -> ConstraintDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstraintDef

Source§

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

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

impl<'de> Deserialize<'de> for ConstraintDef

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for ConstraintDef

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

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

Generates a JSON Schema for this type. Read more
Source§

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 more
Source§

impl PartialEq for ConstraintDef

Source§

fn eq(&self, other: &ConstraintDef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ConstraintDef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConstraintDef

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.