Skip to main content

Protocol

Struct Protocol 

Source
pub struct Protocol {
Show 17 fields pub name: String, pub schema_theory: String, pub instance_theory: String, pub schema_composition: Option<CompositionSpec>, pub instance_composition: Option<CompositionSpec>, pub edge_rules: Vec<EdgeRule>, pub obj_kinds: Vec<String>, pub constraint_sorts: Vec<String>, pub has_order: bool, pub has_coproducts: bool, pub has_recursion: bool, pub has_causal: bool, pub nominal_identity: bool, pub has_defaults: bool, pub has_coercions: bool, pub has_mergers: bool, pub has_policies: bool,
}
Expand description

Identifies the schema and instance theories for a data-format protocol, together with structural well-formedness rules.

Protocols are the Level-1 configuration objects that drive schema construction and validation. Each protocol names a schema theory GAT and an instance theory GAT (both defined in panproto-protocols), and supplies edge rules, recognized vertex kinds, and constraint sorts.

Fields§

§name: String

Human-readable protocol name (e.g., "atproto", "sql").

§schema_theory: String

Name of the schema theory GAT in the theory registry.

§instance_theory: String

Name of the instance theory GAT in the theory registry.

§schema_composition: Option<CompositionSpec>

Composition recipe that produced the schema theory.

§instance_composition: Option<CompositionSpec>

Composition recipe that produced the instance theory.

§edge_rules: Vec<EdgeRule>

Well-formedness rules for each edge kind.

§obj_kinds: Vec<String>

Vertex kinds that are considered “object-like” (containers).

§constraint_sorts: Vec<String>

Recognized constraint sorts (e.g., "maxLength", "format").

§has_order: bool

Whether this protocol uses ordered collections (ThOrder).

§has_coproducts: bool

Whether this protocol has coproduct/union types (ThCoproduct).

§has_recursion: bool

Whether this protocol supports recursive types (ThRecursion).

§has_causal: bool

Whether this protocol has causal/temporal ordering (ThCausal).

§nominal_identity: bool

Whether this protocol uses nominal identity (ThNominal).

§has_defaults: bool

Whether this protocol supports default value expressions (ThValued).

§has_coercions: bool

Whether this protocol supports type coercion expressions (ThCoercible).

§has_mergers: bool

Whether this protocol supports merge/split expressions (ThMergeable).

§has_policies: bool

Whether this protocol supports conflict resolution policies (ThPolicied).

Implementations§

Source§

impl Protocol

Source

pub fn find_edge_rule(&self, edge_kind: &str) -> Option<&EdgeRule>

Returns the EdgeRule for the given edge kind, if one exists.

Source

pub fn is_known_vertex_kind(&self, kind: &str) -> bool

Returns true if kind is a recognized vertex kind in this protocol.

The set of recognized kinds is the union of all kinds mentioned in edge rules (both source and target) plus obj_kinds.

Trait Implementations§

Source§

impl Clone for Protocol

Source§

fn clone(&self) -> Protocol

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Protocol

Source§

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

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

impl Default for Protocol

Source§

fn default() -> Protocol

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Protocol

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 PartialEq for Protocol

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Protocol

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 Eq for Protocol

Source§

impl StructuralPartialEq for Protocol

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

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