Expand description
§Macros for parsing XML into Rust structs, and vice versa
If you are a user of xso_proc
or xso
, please
return to xso
for more information. The documentation of
xso_proc
is geared toward developers of …_macros
and …_core
.
You have been warned.
§How the derive macros work
The processing is roughly grouped in the following stages:
-
syn
is used to parse the incomingTokenStream
into asyn::Item
. Based on that, the decision is made whether a struct or an enum is being derived on. -
Depending on the item type (enum vs. struct), a [
ItemDef
] object is created which implements that item. The actual implementations reside in [crate::structs
] and [crate::enums
] (respectively).-
The [
crate::meta::XmlCompoundMeta
] type is used to convert the raw token streams from the#[xml(..)]
attributes into structs/enums for easier handling.That stage only does syntax checks, no (or just little) semantics. This separation of concerns helps with simplifying the code both in
meta
and the following modules. -
Enum variants and structs are processed using [
crate::compound::Compound
], their fields being converted from [crate::meta::XmlFieldMeta
] to [crate::field::FieldDef
]. For enums, additional processing on the enum itself takes place in [crate::enums
]. Likewise there’s special handling for structs in [crate::structs
]. -
If any wrapping was declared, the resulting
ItemDef
is wrapped using [crate::wrapped
].
-
-
After all data has been structured, action is taken depending on the specific derive macro which has been invoked.
Derive Macros§
- Derive macro for
DynNamespace
. - Derive macro for
FromXml
. - Derive macro for
IntoXml
.