Rocket/codegen/tests/run-pass/error-handler.rs
Sergio Benitez 8c0d11feab Completely new raw API.
Summary of changes:

  * Request no longer has a lifetime parameter.
  * Handler type now includes a `Data` parameter.
  * Response is now an enum that is either `Complete` or `Forward`.
  * Outcome enum is now one of: Success, Failure, Forward.
  * Outcome::Foward for Responses must include StatusCode.
  * Responders are now final: they cannot forward to requests. (!!)
  * Responsers may only forward to catchers. (!!)
  * Response no longer provides wrapping methods.
  * Route is now cloneable.

This change is fundamental to enabling streaming requests.
2016-10-07 23:20:49 -07:00

26 lines
451 B
Rust

#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
use rocket::{Error, Request};
#[error(404)]
fn err0() -> &'static str { "hi" }
#[error(404)]
fn err1a(_err: Error) -> &'static str { "hi" }
#[error(404)]
fn err1b(_req: &Request) -> &'static str { "hi" }
#[error(404)]
fn err2a(_err: Error, _req: &Request) -> &'static str { "hi" }
#[error(404)]
fn err2b<'a>(_err: Error, _req: &'a Request) -> &'a str { "hi" }
fn main() {
}