aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2017-12-23 16:47:00 +0100
committerHarald Eilertsen <haraldei@anduin.net>2017-12-23 16:47:00 +0100
commite5b5a9dc28401815f8e9a68007281d23b3f52825 (patch)
tree2c71b6b85478f47d81d9134f8d5ec280fbdd569a /src
parent33b5c759c18b249f85d06d08e3228e0d1e8e2182 (diff)
downloadrocket-blog-e5b5a9dc28401815f8e9a68007281d23b3f52825.tar.gz
rocket-blog-e5b5a9dc28401815f8e9a68007281d23b3f52825.tar.bz2
rocket-blog-e5b5a9dc28401815f8e9a68007281d23b3f52825.zip
Don't import modules in macro.
Didn't work well when macro was invoked more than once for each source file. Use full references to all symbols instead.
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0549a3f..b05ec3a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -77,16 +77,11 @@ macro_rules! implement_responder_for {
// So it will have to be passed in to the argument at
// the macro incovation instead.
($template_type:ty) => (
- use rocket::response::{Response, Responder};
- use rocket::http::{ContentType, Status};
- use std::io::Cursor;
- use rocket::request::Request;
-
- impl<'a> Responder<'a> for $template_type {
- fn respond_to(self, _: &Request) -> Result<Response<'static>, Status> {
- Response::build()
- .header(ContentType::HTML)
- .sized_body(Cursor::new(format!("{}", &self)))
+ impl<'a> ::rocket::response::Responder<'a> for $template_type {
+ fn respond_to(self, _: &::rocket::Request) -> Result<::rocket::Response<'static>, ::rocket::http::Status> {
+ ::rocket::Response::build()
+ .header(::rocket::http::ContentType::HTML)
+ .sized_body(::std::io::Cursor::new(format!("{}", &self)))
.ok()
}
}