Skip to content

Commit

Permalink
Merge pull request #27 from jeff-at-dwelo/clonable
Browse files Browse the repository at this point in the history
Derive Clone on applicable types
  • Loading branch information
zonyitoo authored Dec 14, 2018
2 parents c9a4a18 + 8ae61ce commit 0dce0bb
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/encodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl Decodable for () {
}

/// Bytes that encoded with length
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct VarBytes(pub Vec<u8>);

impl Encodable for VarBytes {
Expand Down
2 changes: 1 addition & 1 deletion src/packet/connack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::{ConnackFlags, ConnectReturnCode};
use packet::{Packet, PacketError};

/// `CONNACK` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct ConnackPacket {
fixed_header: FixedHeader,
flags: ConnackFlags,
Expand Down
4 changes: 2 additions & 2 deletions src/packet/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use packet::{Packet, PacketError};
use topic_name::{TopicName, TopicNameError};

/// `CONNECT` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct ConnectPacket {
fixed_header: FixedHeader,
protocol_name: ProtocolName,
Expand Down Expand Up @@ -196,7 +196,7 @@ impl Packet for ConnectPacket {
}

/// Payloads for connect packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct ConnectPacketPayload {
client_identifier: String,
will_topic: Option<TopicName>,
Expand Down
2 changes: 1 addition & 1 deletion src/packet/disconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use control::{ControlType, FixedHeader, PacketType};
use packet::{Packet, PacketError};

/// `DISCONNECT` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct DisconnectPacket {
fixed_header: FixedHeader,
payload: (),
Expand Down
2 changes: 1 addition & 1 deletion src/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<T: Packet> From<TopicNameError> for PacketError<T> {
macro_rules! impl_variable_packet {
($($name:ident & $errname:ident => $hdr:ident,)+) => {
/// Variable packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub enum VariablePacket {
$(
$name($name),
Expand Down
2 changes: 1 addition & 1 deletion src/packet/pingreq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use control::{ControlType, FixedHeader, PacketType};
use packet::{Packet, PacketError};

/// `PINGREQ` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PingreqPacket {
fixed_header: FixedHeader,
payload: (),
Expand Down
2 changes: 1 addition & 1 deletion src/packet/pingresp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use control::{ControlType, FixedHeader, PacketType};
use packet::{Packet, PacketError};

/// `PINGRESP` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PingrespPacket {
fixed_header: FixedHeader,
payload: (),
Expand Down
2 changes: 1 addition & 1 deletion src/packet/puback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::PacketIdentifier;
use packet::{Packet, PacketError};

/// `PUBACK` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PubackPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down
2 changes: 1 addition & 1 deletion src/packet/pubcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::PacketIdentifier;
use packet::{Packet, PacketError};

/// `PUBCOMP` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PubcompPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down
2 changes: 1 addition & 1 deletion src/packet/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl QoSWithPacketIdentifier {
}

/// `PUBLISH` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PublishPacket {
fixed_header: FixedHeader,
topic_name: TopicName,
Expand Down
2 changes: 1 addition & 1 deletion src/packet/pubrec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::PacketIdentifier;
use packet::{Packet, PacketError};

/// `PUBREC` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PubrecPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down
2 changes: 1 addition & 1 deletion src/packet/pubrel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::PacketIdentifier;
use packet::{Packet, PacketError};

/// `PUBREL` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct PubrelPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down
4 changes: 2 additions & 2 deletions src/packet/suback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl From<QualityOfService> for SubscribeReturnCode {
}

/// `SUBACK` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct SubackPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down Expand Up @@ -118,7 +118,7 @@ impl Packet for SubackPacket {
}
}

#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct SubackPacketPayload {
subscribes: Vec<SubscribeReturnCode>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/packet/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use packet::{Packet, PacketError};
use topic_filter::{TopicFilter, TopicFilterError};

/// `SUBSCRIBE` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct SubscribePacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down Expand Up @@ -84,7 +84,7 @@ impl Packet for SubscribePacket {
}

/// Payload of subscribe packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct SubscribePacketPayload {
subscribes: Vec<(TopicFilter, QualityOfService)>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/packet/unsuback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use control::variable_header::PacketIdentifier;
use packet::{Packet, PacketError};

/// `UNSUBACK` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct UnsubackPacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down
4 changes: 2 additions & 2 deletions src/packet/unsubscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use packet::{Packet, PacketError};
use topic_filter::{TopicFilter, TopicFilterError};

/// `UNSUBSCRIBE` packet
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct UnsubscribePacket {
fixed_header: FixedHeader,
packet_identifier: PacketIdentifier,
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Packet for UnsubscribePacket {
}
}

#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct UnsubscribePacketPayload {
subscribes: Vec<TopicFilter>,
}
Expand Down

0 comments on commit 0dce0bb

Please sign in to comment.