diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-04-15T19·31+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2018-04-15T19·31+0200 |
commit | ce18cfa2d67ccf6ec560d59da1753930e86d169c (patch) | |
tree | 504f8eb63d615ac7d36de8f2778eade845f6e684 /src/render.rs | |
parent | d9d1a3313f5cbceb5cb4878752fe0dc117bed3b0 (diff) |
refactor: Add a message!-macro to reduce message boilerplate
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/render.rs b/src/render.rs index 0c1e69d3c4c9..c0a2fe88e697 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>; |