1use xmlserde_derives::XmlDeserialize;
2
3use crate::{
4 attribute::Attribute,
5 documentation::{DocDeprecated, DocStability, DocVersion, Documentation, SourcePosition},
6 parameter::Parameters,
7 prelude::*,
8 return_value::ReturnValue,
9 version::Version,
10 Stability,
11};
12
13#[derive(Clone, Debug, XmlDeserialize)]
14#[xmlserde(root = b"method")]
15#[xmlserde(deny_unknown_fields)]
16pub struct Method {
17 #[xmlserde(name = b"glib:get-property", ty = "attr")]
18 get_property: Option<String>,
19 #[xmlserde(name = b"glib:set-property", ty = "attr")]
20 set_property: Option<String>,
21
22 #[xmlserde(name = b"name", ty = "attr")]
24 name: String,
25 #[xmlserde(name = b"c:identifier", ty = "attr")]
26 c_identifier: Option<String>,
27 #[xmlserde(name = b"shadows", ty = "attr")]
28 shadows: Option<String>,
29 #[xmlserde(name = b"shadowed-by", ty = "attr")]
30 shadowed_by: Option<String>,
31 #[xmlserde(name = b"throws", ty = "attr")]
32 throws: Option<bool>,
33 #[xmlserde(name = b"moved-to", ty = "attr")]
34 moved_to: Option<String>,
35 #[xmlserde(name = b"glib:async-func", ty = "attr")]
36 async_func: Option<String>,
37 #[xmlserde(name = b"glib:finish-func", ty = "attr")]
38 finish_func: Option<String>,
39 #[xmlserde(name = b"glib:sync-func", ty = "attr")]
40 sync_func: Option<String>,
41 #[xmlserde(name = b"introspectable", ty = "attr")]
43 introspectable: Option<bool>,
44 #[xmlserde(name = b"deprecated", ty = "attr")]
45 deprecated: Option<bool>,
46 #[xmlserde(name = b"version", ty = "attr")]
47 version: Option<Version>,
48 #[xmlserde(name = b"deprecated-version", ty = "attr")]
49 deprecated_version: Option<Version>,
50 #[xmlserde(name = b"stability", ty = "attr")]
51 stability: Option<Stability>,
52 #[xmlserde(name = b"doc", ty = "child")]
54 doc: Option<Documentation>,
55 #[xmlserde(name = b"doc-deprecated", ty = "child")]
56 doc_deprecated: Option<DocDeprecated>,
57 #[xmlserde(name = b"doc-stability", ty = "child")]
58 doc_stability: Option<DocStability>,
59 #[xmlserde(name = b"doc-version", ty = "child")]
60 doc_version: Option<DocVersion>,
61 #[xmlserde(name = b"source-position", ty = "child")]
62 source_position: Option<SourcePosition>,
63 #[xmlserde(name = b"attribute", ty = "child")]
65 attributes: Vec<Attribute>,
66 #[xmlserde(name = b"return-value", ty = "child")]
67 return_value: ReturnValue,
68 #[xmlserde(name = b"parameters", ty = "child", default = "Parameters::default")]
69 parameters: Parameters,
70}
71
72impl Method {
73 pub fn get_property(&self) -> Option<&str> {
74 self.get_property.as_deref()
75 }
76
77 pub fn set_property(&self) -> Option<&str> {
78 self.set_property.as_deref()
79 }
80}
81
82impl_info!(Method);
83impl_attributable!(Method);
84impl_documentable!(Method);
85impl_callable!(Method);
86impl_function_like!(Method);
87
88#[derive(Clone, Debug, XmlDeserialize)]
89#[xmlserde(root = b"method-inline")]
90#[xmlserde(deny_unknown_fields)]
91pub struct MethodInline {
92 #[xmlserde(name = b"name", ty = "attr")]
94 name: String,
95 #[xmlserde(name = b"c:identifier", ty = "attr")]
96 c_identifier: Option<String>,
97 #[xmlserde(name = b"shadows", ty = "attr")]
98 shadows: Option<String>,
99 #[xmlserde(name = b"shadowed-by", ty = "attr")]
100 shadowed_by: Option<String>,
101 #[xmlserde(name = b"throws", ty = "attr")]
102 throws: Option<bool>,
103 #[xmlserde(name = b"moved-to", ty = "attr")]
104 moved_to: Option<String>,
105 #[xmlserde(name = b"glib:async-func", ty = "attr")]
106 async_func: Option<String>,
107 #[xmlserde(name = b"glib:finish-func", ty = "attr")]
108 finish_func: Option<String>,
109 #[xmlserde(name = b"glib:sync-func", ty = "attr")]
110 sync_func: Option<String>,
111 #[xmlserde(name = b"introspectable", ty = "attr")]
113 introspectable: Option<bool>,
114 #[xmlserde(name = b"deprecated", ty = "attr")]
115 deprecated: Option<bool>,
116 #[xmlserde(name = b"version", ty = "attr")]
117 version: Option<Version>,
118 #[xmlserde(name = b"deprecated-version", ty = "attr")]
119 deprecated_version: Option<Version>,
120 #[xmlserde(name = b"stability", ty = "attr")]
121 stability: Option<Stability>,
122 #[xmlserde(name = b"doc", ty = "child")]
124 doc: Option<Documentation>,
125 #[xmlserde(name = b"doc-deprecated", ty = "child")]
126 doc_deprecated: Option<DocDeprecated>,
127 #[xmlserde(name = b"doc-stability", ty = "child")]
128 doc_stability: Option<DocStability>,
129 #[xmlserde(name = b"doc-version", ty = "child")]
130 doc_version: Option<DocVersion>,
131 #[xmlserde(name = b"source-position", ty = "child")]
132 source_position: Option<SourcePosition>,
133 #[xmlserde(name = b"attribute", ty = "child")]
135 attributes: Vec<Attribute>,
136
137 #[xmlserde(name = b"return-value", ty = "child")]
138 return_value: ReturnValue,
139 #[xmlserde(name = b"parameters", ty = "child", default = "Parameters::default")]
140 parameters: Parameters,
141}
142
143impl_info!(MethodInline);
144impl_attributable!(MethodInline);
145impl_documentable!(MethodInline);
146impl_callable!(MethodInline);
147impl_function_like!(MethodInline);