#![feature(plugin, decl_macro, proc_macro_non_items)] #![plugin(rocket_codegen)] #[macro_use] extern crate rocket; use rocket::http::{Cookies, RawStr}; use rocket::request::Form; #[derive(FromForm)] struct User<'a> { name: &'a RawStr, nickname: String, } #[post("/<_name>?<_query>", format = "application/json", data = "", rank = 2)] fn get( _name: &RawStr, _query: User, user: Form, _cookies: Cookies ) -> String { format!("{}:{}", user.name, user.nickname) } #[test] fn main() { let _ = routes![get]; }