mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-15 09:42:19 +00:00
stores: Switch from dyn to impl and implement Sized
This commit is contained in:
@@ -11,7 +11,7 @@ use tracing::instrument;
|
||||
use tracing_actix_web::RootSpan;
|
||||
|
||||
#[instrument(parent = root_span.id(), skip(store, root_span))]
|
||||
pub async fn get_object<AS: AddressbookStore + ?Sized>(
|
||||
pub async fn get_object<AS: AddressbookStore>(
|
||||
path: Path<AddressObjectPathComponents>,
|
||||
store: Data<AS>,
|
||||
user: User,
|
||||
@@ -43,7 +43,7 @@ pub async fn get_object<AS: AddressbookStore + ?Sized>(
|
||||
}
|
||||
|
||||
#[instrument(parent = root_span.id(), skip(store, req, root_span))]
|
||||
pub async fn put_object<AS: AddressbookStore + ?Sized>(
|
||||
pub async fn put_object<AS: AddressbookStore>(
|
||||
path: Path<AddressObjectPathComponents>,
|
||||
store: Data<AS>,
|
||||
body: String,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{principal::PrincipalResource, Error};
|
||||
use actix_web::dev::ResourceMap;
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into};
|
||||
use derive_more::derive::{Constructor, From, Into};
|
||||
use rustical_dav::{
|
||||
privileges::UserPrivilegeSet,
|
||||
resource::{Resource, ResourceService},
|
||||
@@ -15,16 +15,11 @@ use strum::{EnumDiscriminants, EnumString, IntoStaticStr, VariantNames};
|
||||
|
||||
use super::methods::{get_object, put_object};
|
||||
|
||||
pub struct AddressObjectResourceService<AS: AddressbookStore + ?Sized> {
|
||||
#[derive(Constructor)]
|
||||
pub struct AddressObjectResourceService<AS: AddressbookStore> {
|
||||
addr_store: Arc<AS>,
|
||||
}
|
||||
|
||||
impl<A: AddressbookStore + ?Sized> AddressObjectResourceService<A> {
|
||||
pub fn new(addr_store: Arc<A>) -> Self {
|
||||
Self { addr_store }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone)]
|
||||
#[strum_discriminants(
|
||||
name(AddressObjectPropName),
|
||||
@@ -111,7 +106,7 @@ impl<'de> Deserialize<'de> for AddressObjectPathComponents {
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl<AS: AddressbookStore + ?Sized> ResourceService for AddressObjectResourceService<AS> {
|
||||
impl<AS: AddressbookStore> ResourceService for AddressObjectResourceService<AS> {
|
||||
type PathComponents = AddressObjectPathComponents;
|
||||
type Resource = AddressObjectResource;
|
||||
type MemberType = AddressObjectResource;
|
||||
|
||||
Reference in New Issue
Block a user