openapi_nexus_common/
location.rs1use std::path::PathBuf;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct SourceLocation {
8 pub file_path: Option<PathBuf>,
9 pub line: Option<u32>,
10 pub column: Option<u32>,
11 pub openapi_path: Option<String>,
12}
13
14impl SourceLocation {
15 pub fn new() -> Self {
16 Self {
17 file_path: None,
18 line: None,
19 column: None,
20 openapi_path: None,
21 }
22 }
23
24 pub fn with_file_path(mut self, path: PathBuf) -> Self {
25 self.file_path = Some(path);
26 self
27 }
28
29 pub fn with_line_column(mut self, line: u32, column: u32) -> Self {
30 self.line = Some(line);
31 self.column = Some(column);
32 self
33 }
34
35 pub fn with_openapi_path(mut self, path: String) -> Self {
36 self.openapi_path = Some(path);
37 self
38 }
39}
40
41impl Default for SourceLocation {
42 fn default() -> Self {
43 Self::new()
44 }
45}