1use xmlserde_derives::XmlDeserialize;
2
3use crate::{
4 attribute::Attribute,
5 documentation::{DocDeprecated, DocStability, DocVersion, Documentation, SourcePosition},
6 function::{Function, FunctionInline},
7 member::Member,
8 prelude::*,
9 version::Version,
10 Stability,
11};
12
13#[derive(Clone, Debug, XmlDeserialize)]
14#[xmlserde(root = b"bitfield")]
15#[xmlserde(deny_unknown_fields)]
16pub struct BitField {
17 #[xmlserde(name = b"name", ty = "attr")]
18 name: String,
19 #[xmlserde(name = b"c:type", ty = "attr")]
20 c_type: String,
21 #[xmlserde(name = b"glib:get-type", ty = "attr")]
22 g_get_type: Option<String>,
23 #[xmlserde(name = b"glib:type-name", ty = "attr")]
24 g_type_name: Option<String>,
25 #[xmlserde(name = b"introspectable", ty = "attr")]
27 introspectable: Option<bool>,
28 #[xmlserde(name = b"deprecated", ty = "attr")]
29 deprecated: Option<bool>,
30 #[xmlserde(name = b"version", ty = "attr")]
31 version: Option<Version>,
32 #[xmlserde(name = b"deprecated-version", ty = "attr")]
33 deprecated_version: Option<Version>,
34 #[xmlserde(name = b"stability", ty = "attr")]
35 stability: Option<Stability>,
36 #[xmlserde(name = b"doc", ty = "child")]
38 doc: Option<Documentation>,
39 #[xmlserde(name = b"doc-deprecated", ty = "child")]
40 doc_deprecated: Option<DocDeprecated>,
41 #[xmlserde(name = b"doc-stability", ty = "child")]
42 doc_stability: Option<DocStability>,
43 #[xmlserde(name = b"doc-version", ty = "child")]
44 doc_version: Option<DocVersion>,
45 #[xmlserde(name = b"source-position", ty = "child")]
46 source_position: Option<SourcePosition>,
47 #[xmlserde(name = b"attribute", ty = "child")]
49 attributes: Vec<Attribute>,
50 #[xmlserde(name = b"member", ty = "child")]
52 members: Vec<Member>,
53 #[xmlserde(name = b"function", ty = "child")]
55 functions: Vec<Function>,
56 #[xmlserde(name = b"function-inline", ty = "child")]
57 inline_functions: Vec<FunctionInline>,
58}
59
60impl BitField {
61 pub fn name(&self) -> &str {
62 &self.name
63 }
64
65 pub fn c_type(&self) -> &str {
66 &self.c_type
67 }
68
69 pub fn g_get_type(&self) -> Option<&str> {
70 self.g_get_type.as_deref()
71 }
72
73 pub fn g_type_name(&self) -> Option<&str> {
74 self.g_type_name.as_deref()
75 }
76
77 pub fn members(&self) -> &[Member] {
78 &self.members
79 }
80
81 pub fn functions(&self) -> &[Function] {
82 &self.functions
83 }
84
85 pub fn inlined_functions(&self) -> &[FunctionInline] {
86 &self.inline_functions
87 }
88}
89
90impl_info!(BitField);
91impl_attributable!(BitField);
92impl_documentable!(BitField);