Skip to main content

RelationshipDef

Struct RelationshipDef 

Source
pub struct RelationshipDef {
    pub name: String,
    pub description: String,
    pub when_to_use: Option<String>,
    pub default_weight: f32,
    pub per_edge_description: PerEdgeDescription,
    pub acyclic: bool,
    pub derivation: bool,
    pub source_types: Vec<String>,
    pub target_types: Vec<String>,
    pub cardinality_per_source: Option<Cardinality>,
    pub manual_authoring: ManualAuthoring,
}

Fields§

§name: String§description: String§when_to_use: Option<String>§default_weight: f32§per_edge_description: PerEdgeDescription

Per-edge description posture for edges of this rel-type: forbidden (default) rejects any trailing description text; optional accepts edges with or without a description; required rejects edges without a description. The schema author opts a catch-all rel-type (e.g. OTHER) into required to force per-edge documentation; most rel-types keep the default forbidden posture so the rel-type’s name is the edge’s documentation.

§acyclic: bool

When true, the engine rejects writes that would close a cycle in the subgraph restricted to edges of this relationship type. Defaults to false so existing user schemas stay opt-in. Semantically meaningless on the _default sentinel (never a real edge’s rel_type).

§derivation: bool

When true, edges of this rel-type declare that the SOURCE derives from the TARGET (agent-trust plan 12). Exactly three effects, warn-tier forever: (1) explicitly writing such an edge records the target’s current content hash as the edge’s baseline in the engine-owned derivations sidecar (never in the markdown, never in _hash); (2) the include-gated stale_derivations health axis reports every such edge whose target’s current hash differs from its baseline — and edges with no baseline as unbaselined, distinctly; (3) a duplicate-add memstead_relate on such an edge refreshes the baseline as its one effect — the agent’s explicit “reviewed, still holds” — and the response says so. Never a write-block.

§source_types: Vec<String>

Schema-declared types whose entities may be the source of this edge. Empty (default) means shape-free — any source type admitted. The loader validates every entry against the schema’s declared types list; unknown names raise SchemaLoadError::UndeclaredType. At write time, memstead_relate rejects shape violations with INVALID_REL_SHAPE.

§target_types: Vec<String>

Same as source_types but for the target side. Empty = shape-free.

§cardinality_per_source: Option<Cardinality>

Per-source cardinality hint, parsed and stored on the relationship definition. Declarative only — the engine does not currently enforce it or warn when a relate pushes the source’s outgoing count for this rel_type outside the declared range.

§manual_authoring: ManualAuthoring

Manual-authoring posture for this rel-type. allow (default) admits explicit memstead_relate calls. warn lands the relation with a RELATION_MANUAL_AUTHORING_NOT_RECOMMENDED warning. forbidden refuses explicit-author calls with the typed RELATION_MANUAL_AUTHORING_FORBIDDEN code. The body-link → relation alias machinery (memstead_update / memstead_create’s wiki-link parser) is NOT gated — schema-emitted relations like REFERENCES synthesise unchanged.

Trait Implementations§

Source§

impl Clone for RelationshipDef

Source§

fn clone(&self) -> RelationshipDef

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 RelationshipDef

Source§

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

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

impl<'de> Deserialize<'de> for RelationshipDef

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 RelationshipDef

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 Serialize for RelationshipDef

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

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.