xmpp_parsers/
jingle_rtcp_fb.rs1use xso::{AsXml, FromXml};
8
9use crate::ns;
10
11#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
13#[xml(namespace = ns::JINGLE_RTCP_FB, name = "rtcp-fb")]
14pub struct RtcpFb {
15    #[xml(attribute = "type")]
17    pub type_: String,
18
19    #[xml(attribute(default))]
21    pub subtype: Option<String>,
22}
23
24#[cfg(test)]
25mod tests {
26    use super::*;
27    use minidom::Element;
28
29    #[cfg(target_pointer_width = "32")]
30    #[test]
31    fn test_size() {
32        assert_size!(RtcpFb, 24);
33    }
34
35    #[cfg(target_pointer_width = "64")]
36    #[test]
37    fn test_size() {
38        assert_size!(RtcpFb, 48);
39    }
40
41    #[test]
42    fn parse_simple() {
43        let elem: Element =
44            "<rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack' subtype='sli'/>"
45                .parse()
46                .unwrap();
47        let rtcp_fb = RtcpFb::try_from(elem).unwrap();
48        assert_eq!(rtcp_fb.type_, "nack");
49        assert_eq!(rtcp_fb.subtype.unwrap(), "sli");
50    }
51}