Make all parsed types implement Clone.

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

View file

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

View file

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

View file

@ -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<MediaElement>,
}
#[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<String>,

View file

@ -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<String>,
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Disco {
pub node: Option<String>,
pub identities: Vec<Identity>,

View file

@ -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<u8>),

View file

@ -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<String>,
}
#[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<String>,
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Jingle {
pub action: Action,
pub initiator: Option<Jid>,

View file

@ -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<usize>,
pub height: Option<usize>,

View file

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

View file

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