mirror of https://github.com/rwf2/Rocket.git
26 lines
483 B
Rust
26 lines
483 B
Rust
#![feature(plugin, decl_macro)]
|
|
#![plugin(rocket_codegen)]
|
|
#![allow(dead_code, unused_variables)]
|
|
|
|
extern crate rocket;
|
|
|
|
use rocket::State;
|
|
|
|
type MyState<'r> = State<'r, usize>;
|
|
|
|
type MyVecState<'r, T> = State<'r, Vec<T>>;
|
|
|
|
#[get("/")]
|
|
fn index(state: MyState) { }
|
|
|
|
#[get("/a")]
|
|
fn another(state: MyVecState<usize>) { }
|
|
|
|
#[test]
|
|
fn main() {
|
|
rocket::ignite()
|
|
.manage(10usize)
|
|
.manage(vec![1usize, 2usize, 3usize])
|
|
.mount("/", routes![index, another]);
|
|
}
|