xmpp-parsers: Make everything PartialEq! \o/
This commit is contained in:
parent
c10d0094e9
commit
923a054b81
15 changed files with 21 additions and 25 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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])*
|
||||
|
|
|
|||
Loading…
Reference in a new issue