2017-08-29 03:14:59 +00:00
|
|
|
#![feature(plugin, decl_macro)]
|
2017-02-08 08:56:17 +00:00
|
|
|
#![plugin(rocket_codegen)]
|
|
|
|
#![allow(dead_code, unused_variables)]
|
|
|
|
|
|
|
|
extern crate rocket;
|
|
|
|
|
|
|
|
use rocket::State;
|
|
|
|
|
|
|
|
type MyState<'r> = State<'r, usize>;
|
|
|
|
|
|
|
|
type MyVecState<'r, T: 'r> = State<'r, Vec<T>>;
|
|
|
|
|
|
|
|
#[get("/")]
|
|
|
|
fn index(state: MyState) { }
|
|
|
|
|
|
|
|
#[get("/a")]
|
|
|
|
fn another(state: MyVecState<usize>) { }
|
|
|
|
|
2017-09-10 08:19:38 +00:00
|
|
|
#[test]
|
2017-02-08 08:56:17 +00:00
|
|
|
fn main() {
|
|
|
|
rocket::ignite()
|
|
|
|
.manage(10usize)
|
|
|
|
.manage(vec![1usize, 2usize, 3usize])
|
|
|
|
.mount("/", routes![index, another]);
|
|
|
|
}
|