diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2017-12-23 16:47:00 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2017-12-23 16:47:00 +0100 |
commit | e5b5a9dc28401815f8e9a68007281d23b3f52825 (patch) | |
tree | 2c71b6b85478f47d81d9134f8d5ec280fbdd569a /src | |
parent | 33b5c759c18b249f85d06d08e3228e0d1e8e2182 (diff) | |
download | rocket-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.rs | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -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() } } |