mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
A little more preparation for new DAV Push spec
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use rustical_dav::header::Depth;
|
||||
use rustical_xml::XmlSerialize;
|
||||
use rustical_xml::{Unparsed, XmlDeserialize, XmlSerialize};
|
||||
|
||||
#[derive(Debug, Clone, XmlSerialize, PartialEq)]
|
||||
pub enum Transport {
|
||||
@@ -22,23 +22,39 @@ impl Default for Transports {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(XmlSerialize, PartialEq, Clone)]
|
||||
pub struct SupportedTriggers(#[xml(flatten, ty = "untagged")] pub Vec<SupportedTrigger>);
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Clone)]
|
||||
pub struct SupportedTriggers(#[xml(flatten, ty = "untagged")] pub Vec<Trigger>);
|
||||
|
||||
#[derive(XmlSerialize, PartialEq, Clone)]
|
||||
pub enum SupportedTrigger {
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Debug, Clone)]
|
||||
pub enum Trigger {
|
||||
#[xml(ns = "rustical_dav::namespace::NS_DAVPUSH")]
|
||||
ContentUpdate(ContentUpdate),
|
||||
#[xml(ns = "rustical_dav::namespace::NS_DAVPUSH")]
|
||||
PropertyUpdate(PropertyUpdate),
|
||||
}
|
||||
|
||||
#[derive(XmlSerialize, PartialEq, Clone)]
|
||||
#[derive(XmlSerialize, XmlDeserialize, PartialEq, Clone, Debug)]
|
||||
pub struct ContentUpdate(
|
||||
#[xml(rename = b"depth", ns = "rustical_dav::namespace::NS_DAV")] pub Depth,
|
||||
);
|
||||
|
||||
#[derive(XmlSerialize, PartialEq, Clone)]
|
||||
#[derive(XmlSerialize, PartialEq, Clone, Debug)]
|
||||
pub struct PropertyUpdate(
|
||||
#[xml(rename = b"depth", ns = "rustical_dav::namespace::NS_DAV")] pub Depth,
|
||||
);
|
||||
|
||||
impl XmlDeserialize for PropertyUpdate {
|
||||
fn deserialize<R: std::io::BufRead>(
|
||||
reader: &mut quick_xml::NsReader<R>,
|
||||
start: &quick_xml::events::BytesStart,
|
||||
empty: bool,
|
||||
) -> Result<Self, rustical_xml::XmlError> {
|
||||
#[derive(XmlDeserialize, PartialEq, Clone, Debug)]
|
||||
struct FakePropertyUpdate(
|
||||
#[xml(rename = b"depth", ns = "rustical_dav::namespace::NS_DAV")] pub Depth,
|
||||
#[xml(rename = b"prop", ns = "rustical_dav::namespace::NS_DAV")] pub Unparsed,
|
||||
);
|
||||
let FakePropertyUpdate(depth, _) = FakePropertyUpdate::deserialize(reader, start, empty)?;
|
||||
Ok(Self(depth))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user