Skip to content

Instantly share code, notes, and snippets.

@ctsrc

ctsrc/Cargo.toml Secret

Created April 5, 2018 17:54
Show Gist options
  • Save ctsrc/dc2645843c8ca4a00697275a6c94a256 to your computer and use it in GitHub Desktop.
Save ctsrc/dc2645843c8ca4a00697275a6c94a256 to your computer and use it in GitHub Desktop.
Attempted usage of Rocket + Askama that leads to build failure.
extern crate askama;
fn main ()
{
askama::rerun_if_templates_changed();
}
[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"] }
#![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