mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
35 lines
870 B
Rust
35 lines
870 B
Rust
use rustical_xml::XmlSerialize;
|
|
use strum::VariantArray;
|
|
|
|
// RFC 3253 section-3.1.5
|
|
#[derive(Debug, Clone, XmlSerialize, PartialEq)]
|
|
pub struct SupportedReportSet<T: XmlSerialize + 'static> {
|
|
#[xml(flatten)]
|
|
#[xml(ns = "crate::namespace::NS_DAV")]
|
|
supported_report: Vec<ReportWrapper<T>>,
|
|
}
|
|
|
|
impl<T: XmlSerialize + Clone + 'static> SupportedReportSet<T> {
|
|
pub fn new(methods: Vec<T>) -> 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<T: XmlSerialize> {
|
|
#[xml(ns = "crate::namespace::NS_DAV")]
|
|
report: T,
|
|
}
|