WIP: Start implementing precondition errors

This commit is contained in:
Lennart
2025-06-04 20:03:30 +02:00
parent e57a14cad1
commit 1a827a164f
9 changed files with 239 additions and 167 deletions

View File

@@ -0,0 +1,12 @@
use rustical_xml::{XmlRootTag, XmlSerialize};
#[derive(XmlSerialize, XmlRootTag)]
#[xml(ns = "crate::namespace::NS_DAV", root = b"error")]
#[xml(ns_prefix(
crate::namespace::NS_DAV = b"",
crate::namespace::NS_CARDDAV = b"CARD",
crate::namespace::NS_CALDAV = b"CAL",
crate::namespace::NS_CALENDARSERVER = b"CS",
crate::namespace::NS_DAVPUSH = b"PUSH"
))]
pub struct ErrorElement<'t, T: XmlSerialize>(#[xml(ty = "untagged")] pub &'t T);

View File

@@ -0,0 +1,14 @@
use derive_more::From;
use rustical_xml::{XmlDeserialize, XmlSerialize};
#[derive(XmlDeserialize, XmlSerialize, Debug, Clone, From, PartialEq)]
pub struct HrefElement {
#[xml(ns = "crate::namespace::NS_DAV")]
pub href: String,
}
impl HrefElement {
pub fn new(href: String) -> Self {
Self { href }
}
}

View File

@@ -2,22 +2,12 @@ pub mod multistatus;
mod propfind;
mod resourcetype;
pub mod tag_list;
use derive_more::derive::From;
pub use multistatus::MultistatusElement;
mod href;
pub use href::HrefElement;
pub use propfind::{PropElement, PropfindElement, PropfindType};
pub use resourcetype::{Resourcetype, ResourcetypeInner};
use rustical_xml::{XmlDeserialize, XmlSerialize};
pub use tag_list::TagList;
mod error;
pub mod sync_collection;
#[derive(XmlDeserialize, XmlSerialize, Debug, Clone, From, PartialEq)]
pub struct HrefElement {
#[xml(ns = "crate::namespace::NS_DAV")]
pub href: String,
}
impl HrefElement {
pub fn new(href: String) -> Self {
Self { href }
}
}
pub use error::ErrorElement;