Rocket/codegen/tests/run-pass/complete-decorator.rs
Sergio Benitez 0c44e44641 Use the RawStr type for all form raw strings.
This is a breaking change.

This commit introduces `RawStr` to forms. In particular, after this
commit, the `&str` type no longer implements `FromFormValue`, and so it
cannot be used as a field in forms. Instad, the `&RawStr` can be used.

The `FormItems` iterator now returns an `(&RawStr, &RawStr)` pair.
2017-03-30 23:06:53 -07:00

27 lines
516 B
Rust

#![feature(plugin, custom_derive)]
#![plugin(rocket_codegen)]
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 = "<user>", rank = 2)]
fn get<'r>(name: &str,
query: User<'r>,
user: Form<'r, User<'r>>,
cookies: Cookies)
-> &'static str {
"hi"
}
fn main() {
let _ = routes![get];
}