Make all parsed types implement Clone.

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-21 00:41:15 +01:00
commit 62d9385728
9 changed files with 21 additions and 21 deletions

View file

@ -4,7 +4,7 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Body { pub struct Body {
pub body: String, pub body: String,
} }

View file

@ -4,7 +4,7 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum ChatState { pub enum ChatState {
Active, Active,
Composing, Composing,

View file

@ -9,7 +9,7 @@ use ns;
use media_element::{MediaElement, parse_media_element}; use media_element::{MediaElement, parse_media_element};
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Field { pub struct Field {
pub var: String, pub var: String,
pub type_: String, // TODO: use an enum here. pub type_: String, // TODO: use an enum here.
@ -18,7 +18,7 @@ pub struct Field {
pub media: Vec<MediaElement>, pub media: Vec<MediaElement>,
} }
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum DataFormType { pub enum DataFormType {
Cancel, Cancel,
Form, Form,
@ -44,7 +44,7 @@ impl FromStr for DataFormType {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct DataForm { pub struct DataForm {
pub type_: DataFormType, pub type_: DataFormType,
pub form_type: Option<String>, pub form_type: Option<String>,

View file

@ -7,12 +7,12 @@ use ns;
use data_forms::{DataForm, DataFormType, parse_data_form}; use data_forms::{DataForm, DataFormType, parse_data_form};
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct Feature { pub struct Feature {
pub var: String, pub var: String,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Identity { pub struct Identity {
pub category: String, // TODO: use an enum here. pub category: String, // TODO: use an enum here.
pub type_: String, // TODO: use an enum here. pub type_: String, // TODO: use an enum here.
@ -20,7 +20,7 @@ pub struct Identity {
pub name: Option<String>, pub name: Option<String>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Disco { pub struct Disco {
pub node: Option<String>, pub node: Option<String>,
pub identities: Vec<Identity>, pub identities: Vec<Identity>,

View file

@ -6,7 +6,7 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum Stanza { pub enum Stanza {
Iq, Iq,
Message, Message,
@ -32,7 +32,7 @@ impl FromStr for Stanza {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum IBB { pub enum IBB {
Open { block_size: u16, sid: String, stanza: Stanza }, Open { block_size: u16, sid: String, stanza: Stanza },
Data(u16, String, Vec<u8>), Data(u16, String, Vec<u8>),

View file

@ -7,7 +7,7 @@ use minidom::Element;
use error::Error; use error::Error;
use ns; use ns;
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Action { pub enum Action {
ContentAccept, ContentAccept,
ContentAdd, ContentAdd,
@ -69,7 +69,7 @@ impl FromStr for Action {
// TODO: use a real JID type. // TODO: use a real JID type.
type Jid = String; type Jid = String;
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Creator { pub enum Creator {
Initiator, Initiator,
Responder, Responder,
@ -89,7 +89,7 @@ impl FromStr for Creator {
} }
} }
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Senders { pub enum Senders {
Both, Both,
Initiator, Initiator,
@ -115,7 +115,7 @@ impl FromStr for Senders {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Content { pub struct Content {
pub creator: Creator, pub creator: Creator,
pub disposition: String, pub disposition: String,
@ -126,7 +126,7 @@ pub struct Content {
pub security: Option<String>, pub security: Option<String>,
} }
#[derive(Debug, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Reason { pub enum Reason {
AlternativeSession, //(String), AlternativeSession, //(String),
Busy, Busy,
@ -191,13 +191,13 @@ impl FromStr for Reason {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct ReasonElement { pub struct ReasonElement {
pub reason: Reason, pub reason: Reason,
pub text: Option<String>, pub text: Option<String>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Jingle { pub struct Jingle {
pub action: Action, pub action: Action,
pub initiator: Option<Jid>, pub initiator: Option<Jid>,

View file

@ -4,13 +4,13 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct URI { pub struct URI {
pub type_: String, pub type_: String,
pub uri: String, pub uri: String,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct MediaElement { pub struct MediaElement {
pub width: Option<usize>, pub width: Option<usize>,
pub height: Option<usize>, pub height: Option<usize>,

View file

@ -4,7 +4,7 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct Ping { pub struct Ping {
} }

View file

@ -4,7 +4,7 @@ use error::Error;
use ns; use ns;
#[derive(Debug)] #[derive(Debug, Clone)]
pub enum Receipt { pub enum Receipt {
Request, Request,
Received(String), Received(String),