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"function")]
15#[xmlserde(deny_unknown_fields)]
16pub struct Function {
17 #[xmlserde(name = b"name", ty = "attr")]
19 name: String,
20 #[xmlserde(name = b"c:identifier", ty = "attr")]
21 c_identifier: Option<String>,
22 #[xmlserde(name = b"shadows", ty = "attr")]
23 shadows: Option<String>,
24 #[xmlserde(name = b"shadowed-by", ty = "attr")]
25 shadowed_by: Option<String>,
26 #[xmlserde(name = b"throws", ty = "attr")]
27 throws: Option<bool>,
28 #[xmlserde(name = b"moved-to", ty = "attr")]
29 moved_to: Option<String>,
30 #[xmlserde(name = b"glib:async-func", ty = "attr")]
31 async_func: Option<String>,
32 #[xmlserde(name = b"glib:finish-func", ty = "attr")]
33 finish_func: Option<String>,
34 #[xmlserde(name = b"glib:sync-func", ty = "attr")]
35 sync_func: Option<String>,
36 #[xmlserde(name = b"introspectable", ty = "attr")]
38 introspectable: Option<bool>,
39 #[xmlserde(name = b"deprecated", ty = "attr")]
40 deprecated: Option<bool>,
41 #[xmlserde(name = b"version", ty = "attr")]
42 version: Option<Version>,
43 #[xmlserde(name = b"deprecated-version", ty = "attr")]
44 deprecated_version: Option<Version>,
45 #[xmlserde(name = b"stability", ty = "attr")]
46 stability: Option<Stability>,
47 #[xmlserde(name = b"doc", ty = "child")]
49 doc: Option<Documentation>,
50 #[xmlserde(name = b"doc-deprecated", ty = "child")]
51 doc_deprecated: Option<DocDeprecated>,
52 #[xmlserde(name = b"doc-stability", ty = "child")]
53 doc_stability: Option<DocStability>,
54 #[xmlserde(name = b"doc-version", ty = "child")]
55 doc_version: Option<DocVersion>,
56 #[xmlserde(name = b"source-position", ty = "child")]
57 source_position: Option<SourcePosition>,
58 #[xmlserde(name = b"attribute", ty = "child")]
60 attributes: Vec<Attribute>,
61 #[xmlserde(name = b"return-value", ty = "child")]
62 return_value: ReturnValue,
63 #[xmlserde(name = b"parameters", ty = "child", default = "Parameters::default")]
64 parameters: Parameters,
65}
66
67impl_info!(Function);
68impl_attributable!(Function);
69impl_documentable!(Function);
70impl_callable!(Function);
71impl_function_like!(Function);
72
73#[derive(Clone, Debug, XmlDeserialize)]
74#[xmlserde(root = b"function-inline")]
75#[xmlserde(deny_unknown_fields)]
76pub struct FunctionInline {
77 #[xmlserde(name = b"name", ty = "attr")]
79 name: String,
80 #[xmlserde(name = b"c:identifier", ty = "attr")]
81 c_identifier: Option<String>,
82 #[xmlserde(name = b"shadows", ty = "attr")]
83 shadows: Option<String>,
84 #[xmlserde(name = b"shadowed-by", ty = "attr")]
85 shadowed_by: Option<String>,
86 #[xmlserde(name = b"throws", ty = "attr")]
87 throws: Option<bool>,
88 #[xmlserde(name = b"moved-to", ty = "attr")]
89 moved_to: Option<String>,
90 #[xmlserde(name = b"glib:async-func", ty = "attr")]
91 async_func: Option<String>,
92 #[xmlserde(name = b"glib:finish-func", ty = "attr")]
93 finish_func: Option<String>,
94 #[xmlserde(name = b"glib:sync-func", ty = "attr")]
95 sync_func: Option<String>,
96 #[xmlserde(name = b"introspectable", ty = "attr")]
98 introspectable: Option<bool>,
99 #[xmlserde(name = b"deprecated", ty = "attr")]
100 deprecated: Option<bool>,
101 #[xmlserde(name = b"version", ty = "attr")]
102 version: Option<Version>,
103 #[xmlserde(name = b"deprecated-version", ty = "attr")]
104 deprecated_version: Option<Version>,
105 #[xmlserde(name = b"stability", ty = "attr")]
106 stability: Option<Stability>,
107 #[xmlserde(name = b"doc", ty = "child")]
109 doc: Option<Documentation>,
110 #[xmlserde(name = b"doc-deprecated", ty = "child")]
111 doc_deprecated: Option<DocDeprecated>,
112 #[xmlserde(name = b"doc-stability", ty = "child")]
113 doc_stability: Option<DocStability>,
114 #[xmlserde(name = b"doc-version", ty = "child")]
115 doc_version: Option<DocVersion>,
116 #[xmlserde(name = b"source-position", ty = "child")]
117 source_position: Option<SourcePosition>,
118 #[xmlserde(name = b"attribute", ty = "child")]
120 attributes: Vec<Attribute>,
121
122 #[xmlserde(name = b"return-value", ty = "child")]
123 return_value: ReturnValue,
124 #[xmlserde(name = b"parameters", ty = "child", default = "Parameters::default")]
125 parameters: Parameters,
126}
127
128impl_info!(FunctionInline);
129impl_attributable!(FunctionInline);
130impl_documentable!(FunctionInline);
131impl_callable!(FunctionInline);
132impl_function_like!(FunctionInline);