xmpp-rs-mirror/parsers
Jonas Schäfer 2f7d5edb8a Make TryFrom<Element> chainable
This allows constructs like:

```rust
let residual = match Iq::try_from(stanza) {
  Ok(iq) => return handle_iq(..),
  Err(Error::TypeMismatch(_, _, v)) => v,
  Err(other) => return handle_parse_error(..),
};
let residual = match Message::try_from(stanza) {
  ..
};
let residual = ..
log::warn!("unhandled object: {:?}", residual);
```

The interesting part of this is that this could be used in a loop over a
Vec<Box<dyn FnMut(Element) -> ControlFlow<SomeResult, Element>>, i.e. in
a parsing loop for a generic XML/XMPP stream.

The advantage is that the stanza.is() check runs only once (in
check_self!) and doesn't need to be duplicated outside, and it reduces
the use of magic strings.
2024-03-03 14:50:29 +00:00
..
examples Update edition to 2021 2023-12-15 19:40:09 +00:00
src Make TryFrom<Element> chainable 2024-03-03 14:50:29 +00:00
Cargo.toml Use relative cargo paths when using local copy 2023-12-18 13:06:22 +01:00
ChangeLog parsers: re-export the jid module entirely 2023-10-26 14:03:21 +02:00
doap.xml Added xep-0264 to doap.xml 2024-02-08 16:07:41 +00:00
LICENSE Rename the xmpp-parsers directory to parsers 2021-10-11 08:24:16 +02:00
README.md xmpp-parsers: Add a README 2022-03-07 12:59:43 +01:00

xmpp-parsers

Whats this?

A crate which provides parsers and serialisers for most XMPP elements, to avoid having to deal with XML manually. It validates its inputs by default, and aims at providing useful errors when a particular XML element was invalid.

What license is it under?

MPL-2.0 or later, see the LICENSE file.