Rocket/core/codegen/tests/complete-decorator.rs

29 lines
580 B
Rust
Raw Normal View History

#![feature(plugin, decl_macro, custom_derive)]
#![plugin(rocket_codegen)]
2017-09-10 08:19:38 +00:00
#![allow(dead_code, unused_variables)]
extern crate rocket;
use rocket::http::{Cookies, RawStr};
use rocket::request::Form;
#[derive(FromForm)]
2016-12-21 08:09:22 +00:00
struct User<'a> {
name: &'a RawStr,
2016-12-21 08:09:22 +00:00
nickname: String,
}
2017-08-03 01:44:31 +00:00
#[post("/<name>?<_query>", format = "application/json", data = "<user>", rank = 2)]
fn get<'r>(name: &RawStr,
2017-08-03 01:44:31 +00:00
_query: User<'r>,
2016-12-21 08:09:22 +00:00
user: Form<'r, User<'r>>,
cookies: Cookies)
2016-12-21 08:09:22 +00:00
-> &'static str {
"hi"
}
2017-09-10 08:19:38 +00:00
#[test]
fn main() {
let _ = routes![get];
}