mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
jingle_ibb: Strengthen sid’s type safety.
This commit is contained in:
parent
a219501fed
commit
f6b222f49a
1 changed files with 6 additions and 3 deletions
|
@ -5,8 +5,9 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr;
|
||||
|
||||
use minidom::Element;
|
||||
use minidom::{Element, IntoAttributeValue};
|
||||
|
||||
use error::Error;
|
||||
|
||||
|
@ -14,10 +15,12 @@ use ns;
|
|||
|
||||
use ibb::Stanza;
|
||||
|
||||
generate_id!(StreamId);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Transport {
|
||||
pub block_size: u16,
|
||||
pub sid: String,
|
||||
pub sid: StreamId,
|
||||
pub stanza: Stanza,
|
||||
}
|
||||
|
||||
|
@ -60,7 +63,7 @@ mod tests {
|
|||
let elem: Element = "<transport xmlns='urn:xmpp:jingle:transports:ibb:1' block-size='3' sid='coucou'/>".parse().unwrap();
|
||||
let transport = Transport::try_from(elem).unwrap();
|
||||
assert_eq!(transport.block_size, 3);
|
||||
assert_eq!(transport.sid, "coucou");
|
||||
assert_eq!(transport.sid, StreamId(String::from("coucou")));
|
||||
assert_eq!(transport.stanza, Stanza::Iq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue