Commit graph

42 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
ae3a5b6725 macros: Remove backwards-compatibility variants introduced in the previous commit. 2019-02-24 20:48:19 +01:00
Emmanuel Gil Peyrot
bcd42a26e3 macros: Use a nicer syntax when declaring attributes.
The previous version had a => required|optional|default token, this was
duplicating information for Option types and didn’t look very good.

This new version looks like a type, which can be either Required<_>,
Option<_> or Default<_>, and means the same thing.
2019-02-24 20:26:42 +01:00
Emmanuel Gil Peyrot
f2c3f45a6f data_forms: Stop duplicating FORM_TYPE in memory.
The FORM_TYPE is now only present once, as the form_type member of the
DataForm struct, it isn’t duplicated in fields anymore.

This removes the need to ignore this special field in every single
protocol built on XEP-0128.
2019-02-24 19:52:59 +01:00
Emmanuel Gil Peyrot
637c3eadd7 Fix clippy lints. 2019-02-21 21:00:58 +01:00
Emmanuel Gil Peyrot
409a1dafa9 Move Error, helpers and macros into a util module. 2019-01-13 12:39:51 +01:00
Emmanuel Gil Peyrot
efd7bd5f2f Run cargo fmt. 2018-12-18 15:32:05 +01:00
Emmanuel Gil Peyrot
6b2dd8fe5e Run cargo fix --edition to move to Edition 2018. 2018-12-18 15:27:30 +01:00
Emmanuel Gil Peyrot
7a2dcbee01 Test struct sizes on 32-bit too. 2018-10-28 13:10:48 +01:00
Emmanuel Gil Peyrot
40aedcf184 Test the size of every struct defined here. 2018-10-26 14:26:16 +02:00
Emmanuel Gil Peyrot
5745108eda data_forms: Document this module. 2018-08-08 19:35:32 +02:00
Emmanuel Gil Peyrot
7f12d05fd2 Switch allow→deny(missing_docs) for the whole crate. 2018-08-08 18:48:05 +02:00
Emmanuel Gil Peyrot
bb60af1531 data_forms: Use a macro for <option/>. 2018-05-28 17:05:04 +02:00
Emmanuel Gil Peyrot
93b018e5ac macros: Remove use requirement on ns. 2018-05-14 16:30:28 +02:00
Emmanuel Gil Peyrot
0d4327eb42 macros: Remove use requirement on minidom::IntoAttributeValue. 2018-05-14 16:12:56 +02:00
Emmanuel Gil Peyrot
040792c242 macros: Remove use requirement on std::str::FromStr. 2018-05-14 16:11:22 +02:00
Emmanuel Gil Peyrot
4fb909cfd1 data_forms: Simplify serialisation using .map(). 2017-10-31 23:33:34 +00:00
Emmanuel Gil Peyrot
f85b451fcf Add a new check_no_attributes macro, to avoid the empty list. 2017-10-31 15:47:38 +00:00
Emmanuel Gil Peyrot
9f27f200ca data_forms: Use the new helper macros to simplify parsing. 2017-10-10 18:26:05 +01:00
Emmanuel Gil Peyrot
58760fc28d data_forms: Split field parsing into its own TryFrom impl. 2017-07-29 04:19:58 +01:00
Emmanuel Gil Peyrot
75ae6100b4 data_forms: Remove unneccessary swallowing of an error. 2017-07-29 02:41:42 +01:00
Emmanuel Gil Peyrot
3b6733f38b Upgrade to minidom 0.4.4 to avoid having to redefine IntoElements for each Into<Element>. 2017-07-21 01:20:29 +01:00
Emmanuel Gil Peyrot
5df585ca40 data_forms, ibr, message, presence, roster: Always use into_iter. 2017-07-20 23:09:22 +01:00
Emmanuel Gil Peyrot
1f43cd934b Use TryFrom from the try_from crate, instead of the unstable feature.
This makes xmpp-parsers usable on stable.
2017-07-20 20:03:15 +01:00
Emmanuel Gil Peyrot
a48565e171 data_forms: Fix FORM_TYPE, <title/> and <instructions/> serialisation. 2017-06-25 20:13:43 +01:00
Emmanuel Gil Peyrot
216f6f8389 Fix build and compilation. 2017-06-14 01:57:02 +01:00
Emmanuel Gil Peyrot
ebc7582250 Move the Default implementation into more generate_attribute!. 2017-06-14 00:53:18 +01:00
Emmanuel Gil Peyrot
0f297d2d2d Add a generate_attribute! macro, and use it for the common case. 2017-06-14 00:50:57 +01:00
Emmanuel Gil Peyrot
334f2f78f8 data_forms: Implement IntoElements. 2017-06-11 14:42:11 +01:00
Emmanuel Gil Peyrot
f08c81382c data_forms, media_element: Implement forgotten serialisation. 2017-05-25 01:00:17 +01:00
Emmanuel Gil Peyrot
16e43c0b01 Convert all of the parsers/serialisers into consuming their parameter. 2017-05-23 23:31:33 +01:00
Emmanuel Gil Peyrot
7cdb46b90a data_forms: Replace field_type String with a proper enum. 2017-05-21 17:08:05 +01:00
Emmanuel Gil Peyrot
814a3bd882 data_forms: Add support for required, options, title and instructions. 2017-05-21 16:41:29 +01:00
Emmanuel Gil Peyrot
8673b8f90e data_forms: Switch to Into/TryFrom. 2017-05-06 20:51:39 +01:00
Emmanuel Gil Peyrot
0dd0b444b3 media_element: Switch to Into/TryFrom. 2017-05-06 20:48:41 +01:00
Emmanuel Gil Peyrot
4b90c1dc1f data_forms, disco, jingle, jingle_ft: Remove superfluous “extern crate”. 2017-04-29 22:10:38 +01:00
Emmanuel Gil Peyrot
407e4cceb4 License the project under MPL-2.0. 2017-04-29 22:14:34 +01:00
Emmanuel Gil Peyrot
659eaee14e data_forms: Simplify the FromStr using match. 2017-04-23 03:42:50 +01:00
Emmanuel Gil Peyrot
62d9385728 Make all parsed types implement Clone. 2017-04-21 00:41:15 +01:00
Emmanuel Gil Peyrot
7288c2c74f Import ns itself, and remove the _NS suffix on all namespaces. 2017-04-20 23:16:12 +01:00
Emmanuel Gil Peyrot
b8b0494c19 Fix a stupid copy/paste syntax error. 2017-04-20 00:14:29 +01:00
Emmanuel Gil Peyrot
fc7a0517d3 Replace assert!()s with proper errors in parsers. 2017-04-19 23:41:54 +01:00
Emmanuel Gil Peyrot
9cf1521775 Hello world! 2017-04-18 20:44:36 +01:00