helm_schema_core/
provenance.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
5pub struct SourceSpan {
6 pub start: usize,
8 pub end: usize,
10}
11
12impl SourceSpan {
13 #[must_use]
15 pub fn new(start: usize, end: usize) -> Self {
16 Self { start, end }
17 }
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
22pub struct ContractProvenance {
23 pub template_path: String,
25 pub span: SourceSpan,
27 #[serde(default, skip_serializing_if = "Vec::is_empty")]
29 pub helper_chain: Vec<String>,
30}
31
32impl ContractProvenance {
33 #[must_use]
35 pub fn new(
36 template_path: impl Into<String>,
37 span: SourceSpan,
38 helper_chain: Vec<String>,
39 ) -> Self {
40 Self {
41 template_path: template_path.into(),
42 span,
43 helper_chain,
44 }
45 }
46}