use rustical_xml::XmlSerialize; use strum::VariantArray; // RFC 3253 section-3.1.5 #[derive(Debug, Clone, XmlSerialize, PartialEq)] pub struct SupportedReportSet { #[xml(flatten)] #[xml(ns = "crate::namespace::NS_DAV")] supported_report: Vec>, } impl SupportedReportSet { pub fn new(methods: Vec) -> Self { Self { supported_report: methods .into_iter() .map(|method| ReportWrapper { report: method }) .collect(), } } pub fn all() -> Self where T: VariantArray, { Self::new(T::VARIANTS.to_vec()) } } #[derive(Debug, Clone, XmlSerialize, PartialEq)] pub struct ReportWrapper { #[xml(ns = "crate::namespace::NS_DAV")] report: T, }