mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 04:42:15 +00:00
Some preparation to parse CalDAV REPORT requests with calendar-data
This commit is contained in:
@@ -9,17 +9,17 @@ pub struct PropfindElement {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, XmlDeserialize, PartialEq)]
|
||||
pub struct PropElement(#[xml(ty = "untagged", flatten)] pub Vec<Propname>);
|
||||
pub struct PropElement<PN: XmlDeserialize = Propname>(#[xml(ty = "untagged", flatten)] pub Vec<PN>);
|
||||
|
||||
#[derive(Debug, Clone, XmlDeserialize, PartialEq)]
|
||||
pub struct Propname(#[xml(ty = "tag_name")] pub String);
|
||||
|
||||
#[derive(Debug, Clone, XmlDeserialize, PartialEq)]
|
||||
pub enum PropfindType {
|
||||
pub enum PropfindType<PN: XmlDeserialize = Propname> {
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
Propname,
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
Allprop,
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
Prop(PropElement),
|
||||
Prop(PropElement<PN>),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use rustical_xml::{ValueDeserialize, ValueSerialize, XmlDeserialize};
|
||||
|
||||
use super::PropfindType;
|
||||
use super::{PropfindType, Propname};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum SyncLevel {
|
||||
@@ -16,7 +16,7 @@ impl ValueDeserialize for SyncLevel {
|
||||
_ => {
|
||||
return Err(rustical_xml::XmlError::InvalidValue(
|
||||
rustical_xml::ParseValueError::Other("Invalid sync-level".to_owned()),
|
||||
))
|
||||
));
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -37,13 +37,13 @@ impl ValueSerialize for SyncLevel {
|
||||
// <!-- DAV:limit defined in RFC 5323, Section 5.17 -->
|
||||
// <!-- DAV:prop defined in RFC 4918, Section 14.18 -->
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
pub struct SyncCollectionRequest {
|
||||
pub struct SyncCollectionRequest<PN: XmlDeserialize = Propname> {
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
pub sync_token: String,
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
pub sync_level: SyncLevel,
|
||||
#[xml(ns = "crate::namespace::NS_DAV", ty = "untagged")]
|
||||
pub prop: PropfindType,
|
||||
pub prop: PropfindType<PN>,
|
||||
#[xml(ns = "crate::namespace::NS_DAV")]
|
||||
pub limit: Option<u64>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user