Commit graph

5 commits

Author SHA1 Message Date
Jonas Schäfer
4e9c4883a3 parsers: add xso text trait implementations to types
This allows them to be used as attribute in xso-proc derived structs.
2024-06-30 13:05:15 +02:00
Jonas Schäfer
6ef8dbefa3 parsers: use Error type from xso
This is a large change and as such, it needs good motivation. Let me
remind you of the ultimate goal: we want a derive macro which allows us
to FromXml/IntoXml, and that derive macro should be usable from
`xmpp_parsers` and other crates.

For that, any code generated by the derive macro mustn't depend on any
code in the `xmpp_parsers` crate, because you cannot name the crate you
are in portably (`xmpp_parsers::..` wouldn't resolve within
`xmpp_parsers`, and `crate::..` would point at other crates if the macro
was used in other crates).

We also want to interoperate with code already implementing
`TryFrom<Element>` and `Into<Element>` on structs. This ultimately
requires that we have an error type which is shared by the two
implementations and that error type must be declared in the `xso` crate
to be usable by the macros.

Thus, we port the error type over to use the type declared in `xso`.

This changes the structure of the error type greatly; I do not think
that `xso` should have to know about all the different types we are
parsing there and they don't deserve special treatment. Wrapping them in
a `Box<dyn ..>` seems more appropriate.
2024-06-23 09:40:52 +02:00
6d98ad97cd
parsers: Change deprecated FixedOffset::{east,west} for *_opt
For the second call, the doc says that None is returned when secs is
out-of-bound. It looks like it should be alright to unwrap here

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-11-30 17:21:40 +01:00
Emmanuel Gil Peyrot
464b5de0d0 parsers: Fix some issues reported by clippy. 2021-10-11 16:17:09 +02:00
Emmanuel Gil Peyrot
9410849d7a Rename the xmpp-parsers directory to parsers
This doesn’t change anything to the name of the crate, just makes
autocompletion easier by not sharing the same prefix as the xmpp crate.
2021-10-11 08:24:16 +02:00
Renamed from xmpp-parsers/src/date.rs (Browse further)