-
-
Save ctsrc/dc2645843c8ca4a00697275a6c94a256 to your computer and use it in GitHub Desktop.
Attempted usage of Rocket + Askama that leads to build failure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate askama; | |
fn main () | |
{ | |
askama::rerun_if_templates_changed(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "www-nordstroem-no" | |
version = "0.2.0" | |
authors = ["Erik Nordstrøm <erik@nordstroem.no>"] | |
publish = false | |
[dependencies] | |
rocket = "0.3.7" | |
rocket_codegen = "0.3.7" | |
askama = { version = "0.5", features = ["with-rocket"] } | |
[build-dependencies] | |
askama = { version = "0.5", features = ["with-rocket"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(plugin)] | |
#![plugin(rocket_codegen)] | |
extern crate rocket; | |
#[macro_use] | |
extern crate askama; | |
use askama::Template; | |
#[derive(Template)] | |
#[template(path = "layout.htm")] | |
struct Layout<'a> | |
{ | |
page_id: &'a str, | |
title: &'a str, | |
} | |
#[get("/")] | |
fn index () -> &'static str | |
{ | |
"Hello, world!" | |
} | |
#[derive(Template)] | |
#[template(path = "auth.htm")] | |
struct AuthTemplate<'a> | |
{ | |
_parent: Layout<'a>, | |
challenge: &'a str, | |
} | |
#[get("/auth.htm")] | |
fn auth () -> AuthTemplate<'static> | |
{ | |
AuthTemplate | |
{ | |
_parent: Layout | |
{ | |
page_id: "auth", | |
title: "Authentication Required", | |
}, | |
challenge: "foobar", | |
} | |
} | |
fn main () | |
{ | |
rocket::ignite().mount("/", routes![index]).launch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment