Skip to main content

safe_migrate/model/
types.rs

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