aboutsummaryrefslogtreecommitdiff
path: root/aero-dav/src/realization.rs
diff options
context:
space:
mode:
Diffstat (limited to 'aero-dav/src/realization.rs')
-rw-r--r--aero-dav/src/realization.rs94
1 files changed, 92 insertions, 2 deletions
diff --git a/aero-dav/src/realization.rs b/aero-dav/src/realization.rs
index 7bec729..bfed4d7 100644
--- a/aero-dav/src/realization.rs
+++ b/aero-dav/src/realization.rs
@@ -1,5 +1,6 @@
use super::types as dav;
use super::caltypes as cal;
+use super::acltypes as acl;
use super::xml;
use super::error;
@@ -11,8 +12,8 @@ impl xml::QRead<Disabled> for Disabled {
}
}
impl xml::QWrite for Disabled {
- fn qwrite(&self, _xml: &mut xml::Writer<impl xml::IWrite>) -> impl futures::Future<Output = Result<(), quick_xml::Error>> + Send {
- async { unreachable!(); }
+ async fn qwrite(&self, _xml: &mut xml::Writer<impl xml::IWrite>) -> Result<(), quick_xml::Error> {
+ unreachable!()
}
}
@@ -40,3 +41,92 @@ impl dav::Extension for Calendar
type ResourceType = cal::ResourceType;
}
+// ACL
+#[derive(Debug, PartialEq, Clone)]
+pub struct Acl {}
+impl dav::Extension for Acl
+{
+ type Error = Disabled;
+ type Property = acl::Property;
+ type PropertyRequest = acl::PropertyRequest;
+ type ResourceType = acl::ResourceType;
+}
+
+// All merged
+#[derive(Debug, PartialEq, Clone)]
+pub struct All {}
+impl dav::Extension for All {
+ type Error = cal::Violation;
+ type Property = Property;
+ type PropertyRequest = PropertyRequest;
+ type ResourceType = ResourceType;
+}
+
+#[derive(Debug, PartialEq, Clone)]
+pub enum Property {
+ Cal(cal::Property),
+ Acl(acl::Property),
+}
+impl xml::QRead<Property> for Property {
+ async fn qread(xml: &mut xml::Reader<impl xml::IRead>) -> Result<Self, error::ParsingError> {
+ match cal::Property::qread(xml).await {
+ Err(error::ParsingError::Recoverable) => (),
+ otherwise => return otherwise.map(Property::Cal),
+ }
+ acl::Property::qread(xml).await.map(Property::Acl)
+ }
+}
+impl xml::QWrite for Property {
+ 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,
+ }
+ }
+}
+
+#[derive(Debug, PartialEq, Clone)]
+pub enum PropertyRequest {
+ Cal(cal::PropertyRequest),
+ Acl(acl::PropertyRequest),
+}
+impl xml::QRead<PropertyRequest> for PropertyRequest {
+ async fn qread(xml: &mut xml::Reader<impl xml::IRead>) -> Result<Self, error::ParsingError> {
+ match cal::PropertyRequest::qread(xml).await {
+ Err(error::ParsingError::Recoverable) => (),
+ otherwise => return otherwise.map(PropertyRequest::Cal),
+ }
+ 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> {
+ match self {
+ Self::Cal(c) => c.qwrite(xml).await,
+ Self::Acl(a) => a.qwrite(xml).await,
+ }
+ }
+}
+
+#[derive(Debug, PartialEq, Clone)]
+pub enum ResourceType {
+ Cal(cal::ResourceType),
+ Acl(acl::ResourceType),
+}
+impl xml::QRead<ResourceType> for ResourceType {
+ async fn qread(xml: &mut xml::Reader<impl xml::IRead>) -> Result<Self, error::ParsingError> {
+ match cal::ResourceType::qread(xml).await {
+ Err(error::ParsingError::Recoverable) => (),
+ otherwise => return otherwise.map(ResourceType::Cal),
+ }
+ acl::ResourceType::qread(xml).await.map(ResourceType::Acl)
+ }
+}
+impl xml::QWrite for ResourceType {
+ 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,
+ }
+ }
+}