gir_parser/
documentation.rs

1use xmlserde_derives::XmlDeserialize;
2
3#[derive(Clone, Debug, XmlDeserialize)]
4#[xmlserde(root = b"source-position")]
5#[xmlserde(deny_unknown_fields)]
6pub struct SourcePosition {
7    #[xmlserde(name = b"filename", ty = "attr")]
8    filename: String,
9    #[xmlserde(name = b"line", ty = "attr")]
10    line: String,
11    #[xmlserde(name = b"column", ty = "attr")]
12    column: Option<String>,
13}
14
15impl SourcePosition {
16    pub fn filename(&self) -> &str {
17        &self.filename
18    }
19
20    pub fn line(&self) -> &str {
21        &self.line
22    }
23
24    pub fn column(&self) -> Option<&str> {
25        self.column.as_deref()
26    }
27}
28
29#[derive(Clone, Debug, XmlDeserialize)]
30#[xmlserde(root = b"doc-deprecated")]
31#[xmlserde(deny_unknown_fields)]
32pub struct DocDeprecated {
33    #[xmlserde(name = b"xml:space", ty = "attr")]
34    space: Option<String>,
35    #[xmlserde(name = b"xml:whitespace", ty = "attr")]
36    whitespace: Option<String>,
37    #[xmlserde(ty = "text")]
38    text: String,
39}
40
41impl DocDeprecated {
42    pub fn space(&self) -> Option<&str> {
43        self.space.as_deref()
44    }
45
46    pub fn whitespace(&self) -> Option<&str> {
47        self.whitespace.as_deref()
48    }
49
50    pub fn text(&self) -> &str {
51        &self.text
52    }
53}
54
55#[derive(Clone, Debug, XmlDeserialize)]
56#[xmlserde(root = b"doc-stability")]
57#[xmlserde(deny_unknown_fields)]
58pub struct DocStability {
59    #[xmlserde(name = b"xml:space", ty = "attr")]
60    space: Option<String>,
61    #[xmlserde(name = b"xml:whitespace", ty = "attr")]
62    whitespace: Option<String>,
63    #[xmlserde(ty = "text")]
64    text: String,
65}
66
67impl DocStability {
68    pub fn space(&self) -> Option<&str> {
69        self.space.as_deref()
70    }
71
72    pub fn whitespace(&self) -> Option<&str> {
73        self.whitespace.as_deref()
74    }
75
76    pub fn text(&self) -> &str {
77        &self.text
78    }
79}
80
81#[derive(Clone, Debug, XmlDeserialize)]
82#[xmlserde(root = b"doc-version")]
83#[xmlserde(deny_unknown_fields)]
84pub struct DocVersion {
85    #[xmlserde(name = b"xml:space", ty = "attr")]
86    space: Option<String>,
87    #[xmlserde(name = b"xml:whitespace", ty = "attr")]
88    whitespace: Option<String>,
89    #[xmlserde(ty = "text")]
90    text: String,
91}
92
93impl DocVersion {
94    pub fn space(&self) -> Option<&str> {
95        self.space.as_deref()
96    }
97
98    pub fn whitespace(&self) -> Option<&str> {
99        self.whitespace.as_deref()
100    }
101
102    pub fn text(&self) -> &str {
103        &self.text
104    }
105}
106
107#[derive(Clone, Debug, XmlDeserialize)]
108#[xmlserde(root = b"doc")]
109#[xmlserde(deny_unknown_fields)]
110pub struct Documentation {
111    #[xmlserde(name = b"xml:space", ty = "attr")]
112    space: Option<String>,
113    #[xmlserde(name = b"xml:whitespace", ty = "attr")]
114    whitespace: Option<String>,
115    #[xmlserde(name = b"filename", ty = "attr")]
116    filename: Option<String>,
117    #[xmlserde(name = b"line", ty = "attr")]
118    line: Option<String>,
119    #[xmlserde(name = b"column", ty = "attr")]
120    column: Option<String>,
121    #[xmlserde(ty = "text")]
122    text: String,
123}
124
125impl Documentation {
126    pub fn space(&self) -> Option<&str> {
127        self.space.as_deref()
128    }
129
130    pub fn whitespace(&self) -> Option<&str> {
131        self.whitespace.as_deref()
132    }
133
134    pub fn filename(&self) -> Option<&str> {
135        self.filename.as_deref()
136    }
137
138    pub fn line(&self) -> Option<&str> {
139        self.line.as_deref()
140    }
141
142    pub fn column(&self) -> Option<&str> {
143        self.column.as_deref()
144    }
145
146    pub fn text(&self) -> &str {
147        &self.text
148    }
149}