diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-12-21 23:18:06 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2022-01-04 21:30:15 +0100 |
commit | 4089181f72c6e9c96cceff4dd0905bcda208ec05 (patch) | |
tree | 3812e1a4ad7fd7f3e2ae54b2803a1fd3fa8b93e7 | |
parent | 42d80ad6cdb1a4ff9ff8fcc088b25d5f7b66a393 (diff) | |
download | askama-4089181f72c6e9c96cceff4dd0905bcda208ec05.tar.gz askama-4089181f72c6e9c96cceff4dd0905bcda208ec05.tar.bz2 askama-4089181f72c6e9c96cceff4dd0905bcda208ec05.zip |
askama_rocket: revert to rocket 0.4 for release
Diffstat (limited to '')
-rw-r--r-- | askama_rocket/Cargo.toml | 4 | ||||
-rw-r--r-- | askama_rocket/src/lib.rs | 2 | ||||
-rw-r--r-- | askama_rocket/tests/basic.rs | 12 | ||||
-rw-r--r-- | askama_shared/src/generator.rs | 6 |
4 files changed, 14 insertions, 10 deletions
diff --git a/askama_rocket/Cargo.toml b/askama_rocket/Cargo.toml index 782d4a0..ef5ee42 100644 --- a/askama_rocket/Cargo.toml +++ b/askama_rocket/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "askama_rocket" -version = "0.11.0-rc.2" +version = "0.11.0" description = "Rocket integration for Askama templates" documentation = "https://docs.rs/askama" keywords = ["markup", "template", "jinja2", "html"] @@ -14,4 +14,4 @@ edition = "2018" [dependencies] askama = { version = "0.11.0-beta.1", path = "../askama", default-features = false, features = ["with-rocket", "mime", "mime_guess"] } -rocket = { version = "0.5.0-rc.1", default-features = false } +rocket = { version = "0.4", default-features = false } diff --git a/askama_rocket/src/lib.rs b/askama_rocket/src/lib.rs index ae683c9..39c7c07 100644 --- a/askama_rocket/src/lib.rs +++ b/askama_rocket/src/lib.rs @@ -13,6 +13,6 @@ pub fn respond<T: Template>(t: &T, ext: &str) -> Result<'static> { let ctype = ContentType::from_extension(ext).ok_or(Status::InternalServerError)?; Response::build() .header(ctype) - .sized_body(rsp.len(), Cursor::new(rsp)) + .sized_body(Cursor::new(rsp)) .ok() } diff --git a/askama_rocket/tests/basic.rs b/askama_rocket/tests/basic.rs index bfdb183..0671c4c 100644 --- a/askama_rocket/tests/basic.rs +++ b/askama_rocket/tests/basic.rs @@ -1,10 +1,12 @@ +#![feature(proc_macro_hygiene, decl_macro)] + #[macro_use] extern crate rocket; use askama::Template; use rocket::http::{ContentType, Status}; -use rocket::local::blocking::Client; +use rocket::local::Client; #[derive(Template)] #[template(path = "hello.html")] @@ -19,10 +21,10 @@ fn hello() -> HelloTemplate<'static> { #[test] fn test_rocket() { - let rocket = rocket::build().mount("/", routes![hello]); - let client = Client::tracked(rocket).unwrap(); - let rsp = client.get("/").dispatch(); + let rocket = rocket::ignite().mount("/", routes![hello]); + let client = Client::new(rocket).unwrap(); + let mut rsp = client.get("/").dispatch(); assert_eq!(rsp.status(), Status::Ok); assert_eq!(rsp.content_type(), Some(ContentType::HTML)); - assert_eq!(rsp.into_string().unwrap(), "Hello, world!"); + assert_eq!(rsp.body_string().unwrap(), "Hello, world!"); } diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 1d8d32b..398c106 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -319,15 +319,17 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { let param = syn::GenericParam::Lifetime(syn::LifetimeDef::new(lifetime)); self.write_header( buf, - "::askama_rocket::Responder<'askama, 'static>", + "::askama_rocket::Responder<'askama>", Some(vec![param]), )?; + buf.writeln( "fn respond_to(self, _: &::askama_rocket::Request) \ - -> ::askama_rocket::Result<'static> {", + -> ::askama_rocket::Result<'askama> {", )?; let ext = self.input.extension().unwrap_or("txt"); buf.writeln(&format!("::askama_rocket::respond(&self, {:?})", ext))?; + buf.writeln("}")?; buf.writeln("}")?; Ok(()) |