From 62d9385728b689f7399bfd35f1fcb4ecb4ffaa35 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 21 Apr 2017 00:41:15 +0100 Subject: [PATCH] Make all parsed types implement Clone. --- src/body.rs | 2 +- src/chatstates.rs | 2 +- src/data_forms.rs | 6 +++--- src/disco.rs | 6 +++--- src/ibb.rs | 4 ++-- src/jingle.rs | 14 +++++++------- src/media_element.rs | 4 ++-- src/ping.rs | 2 +- src/receipts.rs | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/body.rs b/src/body.rs index 64624695..45406e6c 100644 --- a/src/body.rs +++ b/src/body.rs @@ -4,7 +4,7 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Body { pub body: String, } diff --git a/src/chatstates.rs b/src/chatstates.rs index 5a9a4dc4..8732d565 100644 --- a/src/chatstates.rs +++ b/src/chatstates.rs @@ -4,7 +4,7 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum ChatState { Active, Composing, diff --git a/src/data_forms.rs b/src/data_forms.rs index 4ea50c96..dd9b3e11 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -9,7 +9,7 @@ use ns; use media_element::{MediaElement, parse_media_element}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Field { pub var: String, pub type_: String, // TODO: use an enum here. @@ -18,7 +18,7 @@ pub struct Field { pub media: Vec, } -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum DataFormType { Cancel, Form, @@ -44,7 +44,7 @@ impl FromStr for DataFormType { } } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct DataForm { pub type_: DataFormType, pub form_type: Option, diff --git a/src/disco.rs b/src/disco.rs index 39befce5..a9d8b370 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -7,12 +7,12 @@ use ns; use data_forms::{DataForm, DataFormType, parse_data_form}; -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub struct Feature { pub var: String, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Identity { pub category: String, // TODO: use an enum here. pub type_: String, // TODO: use an enum here. @@ -20,7 +20,7 @@ pub struct Identity { pub name: Option, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Disco { pub node: Option, pub identities: Vec, diff --git a/src/ibb.rs b/src/ibb.rs index fb368a56..00d30f3f 100644 --- a/src/ibb.rs +++ b/src/ibb.rs @@ -6,7 +6,7 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum Stanza { Iq, Message, @@ -32,7 +32,7 @@ impl FromStr for Stanza { } } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum IBB { Open { block_size: u16, sid: String, stanza: Stanza }, Data(u16, String, Vec), diff --git a/src/jingle.rs b/src/jingle.rs index 40ba69da..2b7f253f 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -7,7 +7,7 @@ use minidom::Element; use error::Error; use ns; -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Action { ContentAccept, ContentAdd, @@ -69,7 +69,7 @@ impl FromStr for Action { // TODO: use a real JID type. type Jid = String; -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Creator { Initiator, Responder, @@ -89,7 +89,7 @@ impl FromStr for Creator { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Senders { Both, Initiator, @@ -115,7 +115,7 @@ impl FromStr for Senders { } } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Content { pub creator: Creator, pub disposition: String, @@ -126,7 +126,7 @@ pub struct Content { pub security: Option, } -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Reason { AlternativeSession, //(String), Busy, @@ -191,13 +191,13 @@ impl FromStr for Reason { } } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct ReasonElement { pub reason: Reason, pub text: Option, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Jingle { pub action: Action, pub initiator: Option, diff --git a/src/media_element.rs b/src/media_element.rs index db40dfc6..b48636a5 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -4,13 +4,13 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct URI { pub type_: String, pub uri: String, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct MediaElement { pub width: Option, pub height: Option, diff --git a/src/ping.rs b/src/ping.rs index adb0f45c..2fb3e5cc 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -4,7 +4,7 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Ping { } diff --git a/src/receipts.rs b/src/receipts.rs index a45a54c1..052982ca 100644 --- a/src/receipts.rs +++ b/src/receipts.rs @@ -4,7 +4,7 @@ use error::Error; use ns; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum Receipt { Request, Received(String),