Skip to main content

safe_migrate/model/
types.rs

1// FILE: ./src/model/types.rs
2use crate::ast::identifiers::ObjectId;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct TypeState {
7    pub id: ObjectId,
8    pub generation: u64,
9    pub kind: TypeKind,
10}
11
12#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13pub enum TypeKind {
14    Enum {
15        variants: Vec<String>,
16    },
17    Domain {
18        base_type: String,
19        /// Derived from `base_type` when a cache enters analysis. Keeping it
20        /// out of the cache preserves the V5 binary format.
21        #[serde(skip)]
22        base_type_id: Option<ObjectId>,
23    },
24    Base,
25    Composite,
26    Range,
27}
28
29#[derive(Debug, Clone, PartialEq)]
30pub enum TypeOverlay {
31    Present(TypeState),
32    Dropped,
33}