From 161e5dcc9bd63fcd1c25084e8475c711bda2918c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 15 Jul 2017 11:37:29 +0100 Subject: [PATCH] jingle: Type Content::name better. --- src/jingle.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jingle.rs b/src/jingle.rs index 224bb54..ece7fa0 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -43,11 +43,13 @@ generate_attribute!(Senders, "senders", { Responder => "responder", }, Default = Both); +generate_id!(ContentId); + #[derive(Debug, Clone)] pub struct Content { pub creator: Creator, pub disposition: String, // TODO: the list of values is defined, use an enum! - pub name: String, + pub name: ContentId, pub senders: Senders, pub description: Option, pub transport: Option, @@ -353,7 +355,7 @@ mod tests { let elem: Element = "".parse().unwrap(); let jingle = Jingle::try_from(elem).unwrap(); assert_eq!(jingle.contents[0].creator, Creator::Initiator); - assert_eq!(jingle.contents[0].name, "coucou"); + assert_eq!(jingle.contents[0].name, ContentId(String::from("coucou"))); assert_eq!(jingle.contents[0].senders, Senders::Both); assert_eq!(jingle.contents[0].disposition, "session");