remove unnecessary enumproperty trait

This commit is contained in:
Lennart
2024-03-27 17:22:38 +01:00
parent 55342309b9
commit e6bc9b0989
5 changed files with 10 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ use rustical_dav::{
use rustical_store::calendar::{Calendar, CalendarStore};
use serde::Serialize;
use std::sync::Arc;
use strum::{EnumProperty, EnumString, IntoStaticStr, VariantNames};
use strum::{EnumString, IntoStaticStr, VariantNames};
use tokio::sync::RwLock;
pub struct CalendarResource<C: CalendarStore + ?Sized> {
@@ -117,20 +117,16 @@ impl Default for UserPrivilegeSet {
}
}
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, EnumProperty, Clone)]
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, Clone)]
#[strum(serialize_all = "kebab-case")]
pub enum CalendarProp {
Resourcetype,
CurrentUserPrincipal,
Owner,
Displayname,
// #[strum(props(tagname = "IC:calendar-color"))]
CalendarColor,
// #[strum(props(tagname = "C:calendar-description"))]
CalendarDescription,
// #[strum(props(tagname = "C:supported-calendar-component-set"))]
SupportedCalendarComponentSet,
// #[strum(props(tagname = "C:supported-calendar-data"))]
SupportedCalendarData,
Getcontenttype,
CurrentUserPrivilegeSet,

View File

@@ -8,7 +8,7 @@ use rustical_store::calendar::CalendarStore;
use rustical_store::event::Event;
use serde::Serialize;
use std::sync::Arc;
use strum::{EnumProperty, EnumString, IntoStaticStr, VariantNames};
use strum::{EnumString, IntoStaticStr, VariantNames};
use tokio::sync::RwLock;
pub struct EventResource<C: CalendarStore + ?Sized> {
@@ -17,11 +17,10 @@ pub struct EventResource<C: CalendarStore + ?Sized> {
pub event: Event,
}
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, EnumProperty, Clone)]
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, Clone)]
#[strum(serialize_all = "kebab-case")]
pub enum EventProp {
Getetag,
#[strum(props(tagname = "C:calendar-data"))]
CalendarData,
Getcontenttype,
}

View File

@@ -7,7 +7,7 @@ use rustical_dav::{resource::Resource, xml_snippets::HrefElement};
use rustical_store::calendar::CalendarStore;
use serde::Serialize;
use std::sync::Arc;
use strum::{EnumProperty, EnumString, IntoStaticStr, VariantNames};
use strum::{EnumString, IntoStaticStr, VariantNames};
use tokio::sync::RwLock;
use super::calendar::CalendarResource;
@@ -39,16 +39,14 @@ pub enum PrincipalPropResponse {
CalendarUserAddressSet(HrefElement),
}
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, EnumProperty, Clone)]
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, Clone)]
#[strum(serialize_all = "kebab-case")]
pub enum PrincipalProp {
Resourcetype,
CurrentUserPrincipal,
#[strum(serialize = "principal-URL")]
PrincipalUrl,
#[strum(props(tagname = "C:calendar-home-set"))]
CalendarHomeSet,
#[strum(props(tagname = "C:calendar-user-address-set"))]
CalendarUserAddressSet,
}

View File

@@ -5,7 +5,7 @@ use rustical_auth::AuthInfo;
use rustical_dav::error::Error;
use rustical_dav::{resource::Resource, xml_snippets::HrefElement};
use serde::Serialize;
use strum::{EnumProperty, EnumString, IntoStaticStr, VariantNames};
use strum::{EnumString, IntoStaticStr, VariantNames};
pub struct RootResource {
prefix: String,
@@ -13,7 +13,7 @@ pub struct RootResource {
path: String,
}
#[derive(EnumString, Debug, VariantNames, EnumProperty, IntoStaticStr, Clone)]
#[derive(EnumString, Debug, VariantNames, IntoStaticStr, Clone)]
#[strum(serialize_all = "kebab-case")]
pub enum RootProp {
Resourcetype,

View File

@@ -6,7 +6,7 @@ use itertools::Itertools;
use rustical_auth::AuthInfo;
use serde::Serialize;
use std::str::FromStr;
use strum::{EnumProperty, VariantNames};
use strum::VariantNames;
// A resource is identified by a URI and has properties
// A resource can also be a collection
@@ -16,7 +16,7 @@ use strum::{EnumProperty, VariantNames};
pub trait Resource: Sized {
type MemberType: Resource;
type UriComponents: Sized; // defines how the resource URI maps to parameters, i.e. /{principal}/{calendar} -> (String, String)
type PropType: FromStr + VariantNames + Into<&'static str> + EnumProperty + Clone;
type PropType: FromStr + VariantNames + Into<&'static str> + Clone;
type PropResponse: Serialize;
async fn acquire_from_request(