rouille::try_or_400
[−]
[src]
macro_rules! try_or_400 { ($result:expr) => { ... }; }
This macro assumes that the current function returns a Result<_, RouteError>
and takes
a Result
. If the expression you pass to the macro is an error, then a
RouteError::WrongInput
is returned.
Example
use rouille::Request; use rouille::RouteError; fn handle_something(request: &Request) -> Result<(), RouteError> { #[derive(RustcDecodable)] struct FormData { field1: u32, field2: String, } let _data: FormData = try_or_400!(rouille::input::get_post_input(request)); Ok(()) }