xmpp-parsers: Make everything PartialEq! \o/

Emmanuel Gil Peyrot created

Change summary

xmpp-parsers/src/bob.rs             | 2 +-
xmpp-parsers/src/data_forms.rs      | 4 ++--
xmpp-parsers/src/disco.rs           | 1 -
xmpp-parsers/src/hashes.rs          | 1 -
xmpp-parsers/src/jingle.rs          | 8 ++++----
xmpp-parsers/src/jingle_ft.rs       | 2 +-
xmpp-parsers/src/jingle_grouping.rs | 1 -
xmpp-parsers/src/jingle_s5b.rs      | 4 ++--
xmpp-parsers/src/message.rs         | 2 +-
xmpp-parsers/src/muc/muc.rs         | 4 ++--
xmpp-parsers/src/pubsub/mod.rs      | 2 +-
xmpp-parsers/src/pubsub/pubsub.rs   | 6 +++---
xmpp-parsers/src/roster.rs          | 1 -
xmpp-parsers/src/rsm.rs             | 4 ++--
xmpp-parsers/src/util/macros.rs     | 4 ++--
15 files changed, 21 insertions(+), 25 deletions(-)

Detailed changes

xmpp-parsers/src/bob.rs πŸ”—

@@ -14,7 +14,7 @@ use std::str::FromStr;
 ///
 /// The text value SHOULD be of the form algo+hash@bob.xmpp.org, this struct
 /// enforces that format.
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, PartialEq)]
 pub struct ContentId {
     hash: Hash,
 }

xmpp-parsers/src/data_forms.rs πŸ”—

@@ -69,7 +69,7 @@ generate_attribute!(
 );
 
 /// Represents a field in a [data form](struct.DataForm.html).
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Field {
     /// The unique identifier for this field, in the form.
     pub var: String,
@@ -187,7 +187,7 @@ generate_attribute!(
 );
 
 /// This is a form to be sent to another entity for filling.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct DataForm {
     /// The type of this form, telling the other party which action to execute.
     pub type_: DataFormType,

xmpp-parsers/src/disco.rs πŸ”—

@@ -27,7 +27,6 @@ impl IqGetPayload for DiscoInfoQuery {}
 
 generate_element!(
 /// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
-#[derive(PartialEq)]
 Feature, "feature", DISCO_INFO,
 attributes: [
     /// Namespace of the feature we want to represent.

xmpp-parsers/src/hashes.rs πŸ”—

@@ -97,7 +97,6 @@ impl IntoAttributeValue for Algo {
 generate_element!(
     /// This element represents a hash of some data, defined by the hash
     /// algorithm used and the computed value.
-    #[derive(PartialEq)]
     Hash, "hash", HASHES,
     attributes: [
         /// The algorithm used to create this hash.

xmpp-parsers/src/jingle.rs πŸ”—

@@ -171,7 +171,7 @@ generate_id!(
 );
 
 /// Enum wrapping all of the various supported descriptions of a Content.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum Description {
     /// Jingle RTP Sessions (XEP-0167) description.
     Rtp(RtpDescription),
@@ -208,7 +208,7 @@ impl From<Description> for Element {
 }
 
 /// Enum wrapping all of the various supported transports of a Content.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum Transport {
     /// Jingle ICE-UDP Bytestreams (XEP-0176) transport.
     IceUdp(IceUdpTransport),
@@ -465,7 +465,7 @@ impl From<Reason> for Element {
 type Lang = String;
 
 /// Informs the recipient of something.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct ReasonElement {
     /// The list of possible reasons to be included in a Jingle iq.
     pub reason: Reason,
@@ -541,7 +541,7 @@ generate_id!(
 );
 
 /// The main Jingle container, to be included in an iq stanza.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Jingle {
     /// The action to execute on both ends.
     pub action: Action,

xmpp-parsers/src/jingle_ft.rs πŸ”—

@@ -16,7 +16,7 @@ use std::str::FromStr;
 
 generate_element!(
     /// Represents a range in a file.
-    #[derive(PartialEq, Default)]
+    #[derive(Default)]
     Range, "range", JINGLE_FT,
     attributes: [
         /// The offset in bytes from the beginning of the file.

xmpp-parsers/src/jingle_grouping.rs πŸ”—

@@ -18,7 +18,6 @@ generate_attribute!(
 );
 
 generate_element!(
-    #[derive(PartialEq)]
     /// Describes a content that should be grouped with other ones.
     Content, "content", JINGLE_GROUPING,
     attributes: [

xmpp-parsers/src/jingle_s5b.rs πŸ”—

@@ -102,7 +102,7 @@ impl Candidate {
 }
 
 /// The payload of a transport.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum TransportPayload {
     /// The responder informs the initiator that the bytestream pointed by this
     /// candidate has been activated.
@@ -126,7 +126,7 @@ pub enum TransportPayload {
 }
 
 /// Describes a Jingle transport using a direct or proxied connection.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Transport {
     /// The stream identifier for this transport.
     pub sid: StreamId,

xmpp-parsers/src/message.rs πŸ”—

@@ -61,7 +61,7 @@ generate_elem_id!(
 );
 
 /// The main structure representing the `<message/>` stanza.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Message {
     /// The JID emitting this stanza.
     pub from: Option<Jid>,

xmpp-parsers/src/muc/muc.rs πŸ”—

@@ -10,7 +10,7 @@ use crate::presence::PresencePayload;
 
 generate_element!(
     /// Represents the query for messages before our join.
-    #[derive(PartialEq, Default)]
+    #[derive(Default)]
     History, "history", MUC,
     attributes: [
         /// How many characters of history to send, in XML characters.
@@ -60,7 +60,7 @@ impl History {
 
 generate_element!(
     /// Represents a room join request.
-    #[derive(PartialEq, Default)]
+    #[derive(Default)]
     Muc, "x", MUC, children: [
         /// Password to use when the room is protected by a password.
         password: Option<String> = ("password", MUC) => String,

xmpp-parsers/src/pubsub/mod.rs πŸ”—

@@ -49,7 +49,7 @@ generate_attribute!(
 );
 
 /// An item from a PubSub node.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Item {
     /// The identifier for this item, unique per node.
     pub id: Option<ItemId>,

xmpp-parsers/src/pubsub/pubsub.rs πŸ”—

@@ -126,7 +126,7 @@ impl Items {
 }
 
 /// Response wrapper for a PubSub `<item/>`.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct Item(pub PubSubItem);
 
 impl_pubsub_item!(Item, PUBSUB);
@@ -196,7 +196,7 @@ generate_element!(
 );
 
 /// Indicate that the subscription can be configured.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct SubscribeOptions {
     /// If `true`, the configuration is actually required.
     required: bool,
@@ -304,7 +304,7 @@ generate_element!(
 /// Main payload used to communicate with a PubSub service.
 ///
 /// `<pubsub xmlns="http://jabber.org/protocol/pubsub"/>`
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum PubSub {
     /// Request to create a new node, with optional suggested name and suggested configuration.
     Create {

xmpp-parsers/src/roster.rs πŸ”—

@@ -46,7 +46,6 @@ generate_attribute!(
 
 generate_element!(
     /// Contact from the user’s contact list.
-    #[derive(PartialEq)]
     Item, "item", ROSTER,
     attributes: [
         /// JID of this contact.

xmpp-parsers/src/rsm.rs πŸ”—

@@ -11,7 +11,7 @@ use std::convert::TryFrom;
 
 /// Requests paging through a potentially big set of items (represented by an
 /// UID).
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct SetQuery {
     /// Limit the number of items, or use the recipient’s defaults if None.
     pub max: Option<usize>,
@@ -92,7 +92,7 @@ impl From<SetQuery> for Element {
 }
 
 /// Describes the paging result of a [query](struct.SetQuery.html).
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub struct SetResult {
     /// The UID of the first item of the page.
     pub first: Option<String>,

xmpp-parsers/src/util/macros.rs πŸ”—

@@ -370,7 +370,7 @@ macro_rules! check_no_unknown_attributes {
 macro_rules! generate_empty_element {
     ($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident) => (
         $(#[$meta])*
-        #[derive(Debug, Clone)]
+        #[derive(Debug, Clone, PartialEq)]
         pub struct $elem;
 
         impl ::std::convert::TryFrom<crate::Element> for $elem {
@@ -642,7 +642,7 @@ macro_rules! generate_element {
     );
     ($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, attributes: [$($(#[$attr_meta:meta])* $attr:ident: $attr_action:tt<$attr_type:ty> = $attr_name:tt),*], children: [$($(#[$child_meta:meta])* $child_ident:ident: $coucou:tt<$child_type:ty> = ($child_name:tt, $child_ns:tt) => $child_constructor:ident),*] $(, text: ($(#[$text_meta:meta])* $text_ident:ident: $codec:ident < $text_type:ty >))*) => (
         $(#[$meta])*
-        #[derive(Debug, Clone)]
+        #[derive(Debug, Clone, PartialEq)]
         pub struct $elem {
             $(
                 $(#[$attr_meta])*