diff --git a/src/site.rs b/src/site.rs index 1cf6ea0..401e84d 100644 --- a/src/site.rs +++ b/src/site.rs @@ -86,15 +86,12 @@ impl Resource for ArticleResource { ).boxed() } - fn get(&self) -> futures::BoxFuture> { - // Accidental clone here: - let data = self.data.clone(); - + fn get(self) -> futures::BoxFuture> { self.head().map(move |head| head .with_body(Layout { - title: &data.title, - body: &data + title: &self.data.title, + body: &self.data }.to_string()) ).boxed() } diff --git a/src/web/resource.rs b/src/web/resource.rs index ab42f2f..65587f8 100644 --- a/src/web/resource.rs +++ b/src/web/resource.rs @@ -12,7 +12,7 @@ type Error = Box; pub trait Resource { fn allow(&self) -> Vec; fn head(&self) -> futures::BoxFuture; - fn get(&self) -> futures::BoxFuture; + fn get(self) -> futures::BoxFuture; fn options(&self) -> Response { Response::new()