diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-16 17:38:34 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-16 17:38:34 +0200 |
commit | 32dfd25f570b7a55bf43752684d286be0f6b2dc2 (patch) | |
tree | dd77871cda851bb5795743a3f04be61cf4c3ad61 /aero-dav/src/realization.rs | |
parent | 6b9542088cd1b66af46e95b787493b601accb495 (diff) | |
download | aerogramme-32dfd25f570b7a55bf43752684d286be0f6b2dc2.tar.gz aerogramme-32dfd25f570b7a55bf43752684d286be0f6b2dc2.zip |
format + WIP calendar-query
Diffstat (limited to 'aero-dav/src/realization.rs')
-rw-r--r-- | aero-dav/src/realization.rs | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/aero-dav/src/realization.rs b/aero-dav/src/realization.rs index bfed4d7..7283e68 100644 --- a/aero-dav/src/realization.rs +++ b/aero-dav/src/realization.rs @@ -1,8 +1,8 @@ -use super::types as dav; -use super::caltypes as cal; use super::acltypes as acl; -use super::xml; +use super::caltypes as cal; use super::error; +use super::types as dav; +use super::xml; #[derive(Debug, PartialEq, Clone)] pub struct Disabled(()); @@ -12,12 +12,15 @@ impl xml::QRead<Disabled> for Disabled { } } impl xml::QWrite for Disabled { - async fn qwrite(&self, _xml: &mut xml::Writer<impl xml::IWrite>) -> Result<(), quick_xml::Error> { + async fn qwrite( + &self, + _xml: &mut xml::Writer<impl xml::IWrite>, + ) -> Result<(), quick_xml::Error> { unreachable!() } } -/// The base WebDAV +/// The base WebDAV /// /// Any extension is disabled through an object we can't build /// due to a private inner element. @@ -33,8 +36,7 @@ impl dav::Extension for Core { // WebDAV with the base Calendar implementation (RFC4791) #[derive(Debug, PartialEq, Clone)] pub struct Calendar {} -impl dav::Extension for Calendar -{ +impl dav::Extension for Calendar { type Error = cal::Violation; type Property = cal::Property; type PropertyRequest = cal::PropertyRequest; @@ -44,8 +46,7 @@ impl dav::Extension for Calendar // ACL #[derive(Debug, PartialEq, Clone)] pub struct Acl {} -impl dav::Extension for Acl -{ +impl dav::Extension for Acl { type Error = Disabled; type Property = acl::Property; type PropertyRequest = acl::PropertyRequest; @@ -77,7 +78,10 @@ impl xml::QRead<Property> for Property { } } impl xml::QWrite for Property { - async fn qwrite(&self, xml: &mut xml::Writer<impl xml::IWrite>) -> Result<(), quick_xml::Error> { + async fn qwrite( + &self, + xml: &mut xml::Writer<impl xml::IWrite>, + ) -> Result<(), quick_xml::Error> { match self { Self::Cal(c) => c.qwrite(xml).await, Self::Acl(a) => a.qwrite(xml).await, @@ -96,11 +100,16 @@ impl xml::QRead<PropertyRequest> for PropertyRequest { Err(error::ParsingError::Recoverable) => (), otherwise => return otherwise.map(PropertyRequest::Cal), } - acl::PropertyRequest::qread(xml).await.map(PropertyRequest::Acl) + acl::PropertyRequest::qread(xml) + .await + .map(PropertyRequest::Acl) } } impl xml::QWrite for PropertyRequest { - async fn qwrite(&self, xml: &mut xml::Writer<impl xml::IWrite>) -> Result<(), quick_xml::Error> { + async fn qwrite( + &self, + xml: &mut xml::Writer<impl xml::IWrite>, + ) -> Result<(), quick_xml::Error> { match self { Self::Cal(c) => c.qwrite(xml).await, Self::Acl(a) => a.qwrite(xml).await, @@ -123,7 +132,10 @@ impl xml::QRead<ResourceType> for ResourceType { } } impl xml::QWrite for ResourceType { - async fn qwrite(&self, xml: &mut xml::Writer<impl xml::IWrite>) -> Result<(), quick_xml::Error> { + async fn qwrite( + &self, + xml: &mut xml::Writer<impl xml::IWrite>, + ) -> Result<(), quick_xml::Error> { match self { Self::Cal(c) => c.qwrite(xml).await, Self::Acl(a) => a.qwrite(xml).await, |