xso: allow omission of namespace and name on extracts

This is a quality-of-life improvement, as it may save lots of typing in
the common case (see the diff in parsers).
This commit is contained in:
Jonas Schäfer 2024-08-03 14:06:41 +02:00
commit df63c2a78f
9 changed files with 129 additions and 54 deletions

View file

@ -316,6 +316,12 @@ expanded to the corresponding namespace URI and the value for the `namespace`
key is implied. Mixing a prefixed name with an explicit `namespace` key is
not allowed.
Both `namespace` and `name` may be omitted. If `namespace` is omitted, it
defaults to the namespace of the surrounding container. If `name` is omitted
and the `extract` meta is being used on a named field, that field's name is
used. If `name` is omitted and `extract` is not used on a named field, an
error is emitted.
The sequence of field meta inside `fields` can be thought of as a nameless
tuple-style struct. The macro generates serialisation/deserialisation code
for that nameless tuple-style struct and uses it to serialise/deserialise