notebook_types/v0/
model_judgment.rs

1use serde::{Deserialize, Serialize};
2use tsify::Tsify;
3use uuid::Uuid;
4
5use super::model::Ob;
6use super::theory::{MorType, ObType};
7
8/// Declares an object in a model of a double theory.
9#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Tsify)]
10#[tsify(into_wasm_abi, from_wasm_abi, missing_as_null)]
11pub struct ObDecl {
12    /// Human-readable name of object.
13    pub name: String,
14
15    /// Globally unique identifier of object.
16    pub id: Uuid,
17
18    /// The object's type in the double theory.
19    #[serde(rename = "obType")]
20    pub ob_type: ObType,
21}
22
23/// Declares a morphism in a model of a double theory.
24#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Tsify)]
25#[tsify(into_wasm_abi, from_wasm_abi, missing_as_null)]
26pub struct MorDecl {
27    /// Human-readable name of morphism.
28    pub name: String,
29
30    /// Globally unique identifier of morphism.
31    pub id: Uuid,
32
33    /// The morphism's type in the double theory.
34    #[serde(rename = "morType")]
35    pub mor_type: MorType,
36
37    /// Domain of morphism, if defined.
38    pub dom: Option<Ob>,
39
40    /// Codomain of morphism, if defined.
41    pub cod: Option<Ob>,
42}
43
44#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Tsify)]
45#[serde(tag = "tag")]
46#[tsify(into_wasm_abi, from_wasm_abi)]
47pub enum ModelJudgment {
48    #[serde(rename = "object")]
49    Object(ObDecl),
50    #[serde(rename = "morphism")]
51    Morphism(MorDecl),
52}