From 7ea97b261756bc4964a0f7133b3e1f6edeb3300b Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 18 Jun 2023 15:10:06 +0200 Subject: [PATCH] Get rid of lifetime on Service --- src/service/http.rs | 14 +++++++------- src/service/http/tpl.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/service/http.rs b/src/service/http.rs index a7bbab0..8c2160f 100644 --- a/src/service/http.rs +++ b/src/service/http.rs @@ -14,20 +14,20 @@ use crate::{domain, origin, service}; type SvcResponse = Result, String>; #[derive(Clone)] -pub struct Service<'svc> { +pub struct Service { domain_manager: sync::Arc, target_a: net::Ipv4Addr, passphrase: String, http_domain: domain::Name, - handlebars: handlebars::Handlebars<'svc>, + handlebars: handlebars::Handlebars<'static>, } -pub fn new<'svc>( +pub fn new( domain_manager: sync::Arc, target_a: net::Ipv4Addr, passphrase: String, http_domain: domain::Name, -) -> Service<'svc> { +) -> Service { Service { domain_manager, target_a, @@ -59,7 +59,7 @@ struct DomainSyncArgs { passphrase: String, } -impl<'svc> Service<'svc> { +impl<'svc> Service { fn serve_string(&self, status_code: u16, path: &'_ str, body: Vec) -> SvcResponse { let content_type = mime_guess::from_path(path) .first_or_octet_stream() @@ -307,7 +307,7 @@ impl<'svc> Service<'svc> { } pub async fn handle_request( - svc: sync::Arc>, + svc: sync::Arc, req: Request, ) -> Result, Infallible> { match handle_request_inner(svc, req).await { @@ -323,7 +323,7 @@ fn strip_port(host: &str) -> &str { } } -pub async fn handle_request_inner(svc: sync::Arc>, req: Request) -> SvcResponse { +pub async fn handle_request_inner(svc: sync::Arc, req: Request) -> SvcResponse { let maybe_host = match ( req.headers() .get("Host") diff --git a/src/service/http/tpl.rs b/src/service/http/tpl.rs index e25422e..cb1e8d5 100644 --- a/src/service/http/tpl.rs +++ b/src/service/http/tpl.rs @@ -5,7 +5,7 @@ use handlebars::Handlebars; #[prefix = "/"] struct Dir; -pub fn get<'hbs>() -> Handlebars<'hbs> { +pub fn get() -> Handlebars<'static> { let mut reg = Handlebars::new(); reg.register_embed_templates::() .expect("registered embedded templates");