about summary refs log tree commit diff
path: root/src/render.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-15T19·31+0200
committerVincent Ambo <tazjin@gmail.com>2018-04-15T19·31+0200
commitce18cfa2d67ccf6ec560d59da1753930e86d169c (patch)
tree504f8eb63d615ac7d36de8f2778eade845f6e684 /src/render.rs
parentd9d1a3313f5cbceb5cb4878752fe0dc117bed3b0 (diff)
refactor: Add a message!-macro to reduce message boilerplate
Diffstat (limited to 'src/render.rs')
-rw-r--r--src/render.rs20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/render.rs b/src/render.rs
index 0c1e69d3c4..c0a2fe88e6 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -49,10 +49,7 @@ impl From<DateTime<Utc>> for FormattedDate {
 pub struct IndexPage {
     pub threads: Vec<ThreadIndex>,
 }
-
-impl Message for IndexPage {
-    type Result = Result<String>;
-}
+message!(IndexPage, Result<String>);
 
 #[derive(Debug, Serialize)]
 struct IndexThread {
@@ -90,10 +87,7 @@ pub struct ThreadPage {
     pub thread: Thread,
     pub posts: Vec<Post>,
 }
-
-impl Message for ThreadPage {
-    type Result = Result<String>;
-}
+message!(ThreadPage, Result<String>);
 
 // "Renderable" structures with data transformations applied.
 #[derive(Debug, Serialize)]
@@ -200,10 +194,7 @@ pub struct NewThreadPage {
     pub title: Option<String>,
     pub post: Option<String>,
 }
-
-impl Message for NewThreadPage {
-    type Result = Result<String>;
-}
+message!(NewThreadPage, Result<String>);
 
 impl Handler<NewThreadPage> for Renderer {
     type Result = Result<String>;
@@ -225,10 +216,7 @@ pub struct SearchResultPage {
     pub query: String,
     pub results: Vec<SearchResult>,
 }
-
-impl Message for SearchResultPage {
-    type Result = Result<String>;
-}
+message!(SearchResultPage, Result<String>);
 
 impl Handler<SearchResultPage> for Renderer {
     type Result = Result<String>;