code_moniker_workspace/snapshot/view/
model.rs1use std::collections::BTreeMap;
2
3use super::super::model::{
4 ChangeId, ChangeStatus, ReferenceId, SourceId, SymbolId, UnresolvedReason,
5};
6
7#[derive(Clone, Debug, Eq, PartialEq)]
8pub struct SourceSummary {
9 pub id: SourceId,
10 pub display_name: String,
11 pub language: Option<String>,
12 pub change_count: usize,
13}
14
15#[derive(Clone, Debug, Eq, PartialEq)]
16pub struct SymbolSummary {
17 pub id: SymbolId,
18 pub source: SourceId,
19 pub identity: std::sync::Arc<str>,
20 pub name: String,
21 pub kind: String,
22 pub line_range: Option<(u32, u32)>,
23 pub child_count: usize,
24 pub change: Option<ChangeStatus>,
25}
26
27#[derive(Clone, Debug, Eq, PartialEq)]
28pub struct SymbolDetail {
29 pub symbol: SymbolSummary,
30 pub children: Vec<SymbolSummary>,
31}
32
33#[derive(Clone, Copy, Debug, Eq, PartialEq)]
34pub enum ReferenceDirection {
35 Incoming,
36 Outgoing,
37}
38
39#[derive(Clone, Debug, Eq, PartialEq)]
40pub struct SymbolReferences {
41 pub symbol: SymbolSummary,
42 pub incoming: ReferenceSet,
43 pub outgoing: ReferenceSet,
44}
45
46#[derive(Clone, Debug, Eq, PartialEq)]
47pub struct ReferenceSet {
48 pub summary: ReferenceSetSummary,
49 pub groups: Vec<ReferenceSummary>,
50}
51
52#[derive(Clone, Debug, Eq, PartialEq)]
53pub struct ReferenceSetSummary {
54 pub refs: usize,
55 pub files: usize,
56 pub contexts: usize,
57}
58
59#[derive(Clone, Debug, Eq, PartialEq)]
60pub struct ReferenceSummary {
61 pub reference: ReferenceId,
62 pub source: Option<SourceId>,
63 pub context: Option<SymbolId>,
64 pub actor: String,
65 pub endpoint_label: &'static str,
66 pub endpoint: String,
67 pub kind: String,
68 pub line_range: Option<(u32, u32)>,
69}
70
71#[derive(Clone, Debug, Eq, PartialEq)]
72pub struct SearchHit {
73 pub symbol: SymbolId,
74 pub score: u32,
75 pub reason: String,
76}
77
78#[derive(Clone, Debug, Eq, PartialEq)]
79pub struct ChangeSummary {
80 pub id: ChangeId,
81 pub status: ChangeStatus,
82 pub source: Option<SourceId>,
83 pub symbol: Option<SymbolId>,
84 pub identity: String,
85 pub name: String,
86 pub kind: String,
87 pub line_range: Option<(u32, u32)>,
88 pub hunk_count: usize,
89 pub usage_count: usize,
90}
91
92#[derive(Clone, Debug, Eq, PartialEq)]
93pub struct ChangeDetail {
94 pub summary: ChangeSummary,
95 pub blast_radius: ReferenceSet,
96}
97
98#[derive(Clone, Debug, Eq, PartialEq)]
99pub struct UnresolvedLinkageReport {
100 pub unresolved_refs: usize,
101 pub sources: BTreeMap<SourceId, usize>,
102 pub reasons: BTreeMap<UnresolvedReason, usize>,
103}