omena_query/style/cross_file_hypergraph/
edge.rs1use serde::Serialize;
2
3use crate::OmenaQueryLinearProvenanceV0;
4
5#[non_exhaustive]
6#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
7#[serde(rename_all = "camelCase")]
8pub enum UnifiedHypergraphEdgeKindV0 {
9 ComposesLocal,
10 ComposesGlobal,
11 ComposesExternal,
12 SassUse,
13 SassForward,
14 SassImport,
15 Value,
16 Icss,
17 ForeignReference,
18}
19
20impl UnifiedHypergraphEdgeKindV0 {
21 pub const fn as_wire_label(self) -> &'static str {
22 match self {
23 Self::ComposesLocal => "composesLocal",
24 Self::ComposesGlobal => "composesGlobal",
25 Self::ComposesExternal => "composesExternal",
26 Self::SassUse => "sassUse",
27 Self::SassForward => "sassForward",
28 Self::SassImport => "sassImport",
29 Self::Value => "value",
30 Self::Icss => "icss",
31 Self::ForeignReference => "foreignReference",
32 }
33 }
34
35 pub const fn is_order_significant(self) -> bool {
36 matches!(
37 self,
38 Self::ComposesLocal | Self::ComposesGlobal | Self::ComposesExternal
39 )
40 }
41}
42
43#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
44#[serde(rename_all = "camelCase")]
45pub struct UnifiedHypergraphHyperedgeV0 {
46 pub schema_version: &'static str,
47 pub product: &'static str,
48 pub layer_marker: &'static str,
49 pub feature_gate: &'static str,
50 pub hyperedge_id: String,
51 pub edge_kind: UnifiedHypergraphEdgeKindV0,
52 pub source_summary_edge_id: String,
53 pub source_edge_kind: &'static str,
54 pub source_status: &'static str,
55 pub tail_node_ids: Vec<String>,
56 pub head_node_id: String,
57 pub order_significant_tail: bool,
58}
59
60#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
61#[serde(rename_all = "camelCase")]
62pub struct HypergraphIFDSSummaryEdgeV0 {
63 pub schema_version: &'static str,
64 pub product: &'static str,
65 pub layer_marker: &'static str,
66 pub feature_gate: &'static str,
67 pub summary_edge_id: String,
68 pub projection_edge_id: String,
69 pub hyperedge_id: String,
70 pub from_node_id: String,
71 pub to_node_id: String,
72 pub edge_kind: UnifiedHypergraphEdgeKindV0,
73 pub status: &'static str,
74 pub provenance: Vec<&'static str>,
75 pub linear_provenance: OmenaQueryLinearProvenanceV0,
76}