mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 04:42:15 +00:00
WIP: Start implementing precondition errors
This commit is contained in:
12
crates/dav/src/xml/error.rs
Normal file
12
crates/dav/src/xml/error.rs
Normal 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);
|
||||
14
crates/dav/src/xml/href.rs
Normal file
14
crates/dav/src/xml/href.rs
Normal 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 }
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user