Add ?Sized to CalendarStore generics for dynamic dispatch

This commit is contained in:
Lennart
2023-10-08 14:47:36 +02:00
parent e17e4facd7
commit f6cf5bd645
8 changed files with 21 additions and 18 deletions

View File

@@ -35,7 +35,7 @@ async fn _parse_filter(filter_node: &Node<'_, '_>) {
}
}
async fn handle_report_calendar_query<C: CalendarStore>(
async fn handle_report_calendar_query<C: CalendarStore + ?Sized>(
query_node: Node<'_, '_>,
request: HttpRequest,
events: Vec<Event>,
@@ -76,7 +76,7 @@ async fn handle_report_calendar_query<C: CalendarStore>(
.body(output))
}
pub async fn route_report_calendar<A: CheckAuthentication, C: CalendarStore>(
pub async fn route_report_calendar<A: CheckAuthentication, C: CalendarStore + ?Sized>(
context: Data<CalDavContext<C>>,
body: String,
path: Path<(String, String)>,
@@ -101,7 +101,7 @@ pub async fn route_report_calendar<A: CheckAuthentication, C: CalendarStore>(
handle_report_calendar_query(query_node, request, events, context.store.clone()).await
}
pub async fn handle_mkcol_calendar_set<C: CalendarStore>(
pub async fn handle_mkcol_calendar_set<C: CalendarStore + ?Sized>(
store: &RwLock<C>,
prop_node: Node<'_, '_>,
cid: String,
@@ -139,7 +139,7 @@ pub async fn handle_mkcol_calendar_set<C: CalendarStore>(
Ok(())
}
pub async fn route_mkcol_calendar<A: CheckAuthentication, C: CalendarStore>(
pub async fn route_mkcol_calendar<A: CheckAuthentication, C: CalendarStore + ?Sized>(
path: Path<(String, String)>,
body: String,
auth: AuthInfoExtractor<A>,

View File

@@ -23,7 +23,7 @@ impl ResponseError for Error {
}
}
pub async fn delete_event<A: CheckAuthentication, C: CalendarStore>(
pub async fn delete_event<A: CheckAuthentication, C: CalendarStore + ?Sized>(
context: Data<CalDavContext<C>>,
path: Path<(String, String, String)>,
auth: AuthInfoExtractor<A>,
@@ -39,7 +39,7 @@ pub async fn delete_event<A: CheckAuthentication, C: CalendarStore>(
Ok(HttpResponse::Ok().body(""))
}
pub async fn get_event<A: CheckAuthentication, C: CalendarStore>(
pub async fn get_event<A: CheckAuthentication, C: CalendarStore + ?Sized>(
context: Data<CalDavContext<C>>,
path: Path<(String, String, String)>,
_auth: AuthInfoExtractor<A>,
@@ -56,7 +56,7 @@ pub async fn get_event<A: CheckAuthentication, C: CalendarStore>(
.body(event.get_ics()))
}
pub async fn put_event<A: CheckAuthentication, C: CalendarStore>(
pub async fn put_event<A: CheckAuthentication, C: CalendarStore + ?Sized>(
context: Data<CalDavContext<C>>,
path: Path<(String, String, String)>,
body: String,

View File

@@ -66,7 +66,7 @@ fn parse_propfind(body: &str) -> Result<Vec<&str>, Error> {
}
}
pub async fn route_propfind<A: CheckAuthentication, R: Resource, C: CalendarStore>(
pub async fn route_propfind<A: CheckAuthentication, R: Resource, C: CalendarStore + ?Sized>(
path: Path<R::UriComponents>,
body: String,
req: HttpRequest,