Skip to main content

lex_vcs/
diff_report.rs

1//! Plain-data shape of the `lex ast-diff` output. Lives in lex-vcs
2//! so both the CLI (which produces it) and `diff_to_ops` (which
3//! consumes it) can share types without a cyclic dep.
4
5use serde::Serialize;
6
7#[derive(Debug, Clone, Serialize)]
8pub struct AddRemove {
9    pub name: String,
10    pub signature: String,
11}
12
13#[derive(Debug, Clone, Serialize)]
14pub struct Renamed {
15    pub from: String,
16    pub to: String,
17    pub signature: String,
18}
19
20#[derive(Debug, Clone, Serialize)]
21pub struct Modified {
22    pub name: String,
23    pub signature_before: String,
24    pub signature_after: String,
25    pub signature_changed: bool,
26    pub effect_changes: EffectChanges,
27    pub body_patches: Vec<BodyPatch>,
28}
29
30#[derive(Debug, Clone, Serialize, Default)]
31pub struct EffectChanges {
32    pub before: Vec<String>,
33    pub after: Vec<String>,
34    pub added: Vec<String>,
35    pub removed: Vec<String>,
36}
37
38#[derive(Debug, Clone, Serialize)]
39pub struct BodyPatch {
40    pub op: String,
41    pub node_path: String,
42    pub from_kind: String,
43    pub to_kind: String,
44}
45
46#[derive(Debug, Clone, Serialize, Default)]
47pub struct DiffReport {
48    pub added: Vec<AddRemove>,
49    pub removed: Vec<AddRemove>,
50    pub renamed: Vec<Renamed>,
51    pub modified: Vec<Modified>,
52}