use crate::core::{FromXml, IntoXml};
use crate::ns::JINGLE_RTCP_FB;
#[derive(FromXml, IntoXml, Debug, PartialEq, Clone)]
#[xml(namespace = JINGLE_RTCP_FB, name = "rtcp-fb")]
pub struct RtcpFb {
#[xml(attribute(name = "type"))]
pub type_: String,
#[xml(attribute)]
pub subtype: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
use crate::Element;
#[cfg(target_pointer_width = "32")]
#[test]
fn test_size() {
assert_size!(RtcpFb, 24);
}
#[cfg(target_pointer_width = "64")]
#[test]
fn test_size() {
assert_size!(RtcpFb, 48);
}
#[test]
fn parse_simple() {
let elem: Element =
"<rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack' subtype='sli'/>"
.parse()
.unwrap();
let rtcp_fb = RtcpFb::try_from(elem).unwrap();
assert_eq!(rtcp_fb.type_, "nack");
assert_eq!(rtcp_fb.subtype.unwrap(), "sli");
}
}