aboutsummaryrefslogtreecommitdiff
path: root/aero-dav/src/acldecoder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'aero-dav/src/acldecoder.rs')
-rw-r--r--aero-dav/src/acldecoder.rs44
1 files changed, 30 insertions, 14 deletions
diff --git a/aero-dav/src/acldecoder.rs b/aero-dav/src/acldecoder.rs
index 67dfb0b..405286e 100644
--- a/aero-dav/src/acldecoder.rs
+++ b/aero-dav/src/acldecoder.rs
@@ -1,23 +1,31 @@
use super::acltypes::*;
-use super::types as dav;
-use super::xml::{QRead, Reader, IRead, DAV_URN};
use super::error::ParsingError;
+use super::types as dav;
+use super::xml::{IRead, QRead, Reader, DAV_URN};
impl QRead<Property> for Property {
async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> {
if xml.maybe_open_start(DAV_URN, "owner").await?.is_some() {
let href = xml.find().await?;
xml.close().await?;
- return Ok(Self::Owner(href))
+ return Ok(Self::Owner(href));
}
- if xml.maybe_open_start(DAV_URN, "current-user-principal").await?.is_some() {
+ if xml
+ .maybe_open_start(DAV_URN, "current-user-principal")
+ .await?
+ .is_some()
+ {
let user = xml.find().await?;
xml.close().await?;
- return Ok(Self::CurrentUserPrincipal(user))
+ return Ok(Self::CurrentUserPrincipal(user));
}
- if xml.maybe_open_start(DAV_URN, "current-user-privilege-set").await?.is_some() {
+ if xml
+ .maybe_open_start(DAV_URN, "current-user-privilege-set")
+ .await?
+ .is_some()
+ {
xml.close().await?;
- return Ok(Self::CurrentUserPrivilegeSet(vec![]))
+ return Ok(Self::CurrentUserPrivilegeSet(vec![]));
}
Err(ParsingError::Recoverable)
@@ -28,17 +36,25 @@ impl QRead<PropertyRequest> for PropertyRequest {
async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> {
if xml.maybe_open(DAV_URN, "owner").await?.is_some() {
xml.close().await?;
- return Ok(Self::Owner)
+ return Ok(Self::Owner);
}
- if xml.maybe_open(DAV_URN, "current-user-principal").await?.is_some() {
+ if xml
+ .maybe_open(DAV_URN, "current-user-principal")
+ .await?
+ .is_some()
+ {
xml.close().await?;
- return Ok(Self::CurrentUserPrincipal)
+ return Ok(Self::CurrentUserPrincipal);
}
- if xml.maybe_open(DAV_URN, "current-user-privilege-set").await?.is_some() {
+ if xml
+ .maybe_open(DAV_URN, "current-user-privilege-set")
+ .await?
+ .is_some()
+ {
xml.close().await?;
- return Ok(Self::CurrentUserPrivilegeSet)
+ return Ok(Self::CurrentUserPrivilegeSet);
}
Err(ParsingError::Recoverable)
@@ -49,7 +65,7 @@ impl QRead<ResourceType> for ResourceType {
async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> {
if xml.maybe_open(DAV_URN, "principal").await?.is_some() {
xml.close().await?;
- return Ok(Self::Principal)
+ return Ok(Self::Principal);
}
Err(ParsingError::Recoverable)
}
@@ -60,7 +76,7 @@ impl QRead<User> for User {
async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> {
if xml.maybe_open(DAV_URN, "unauthenticated").await?.is_some() {
xml.close().await?;
- return Ok(Self::Unauthenticated)
+ return Ok(Self::Unauthenticated);
}
dav::Href::qread(xml).await.map(Self::Authenticated)