pub type Result<R> = Result<R, Error>;Expand description
A specialized Result type that uses rocket_json::Error.
This typedef is generally used to avoid writing out rocket_json::Error directly and
is otherwise a direct mapping to Result.
§Examples
use rocket_contrib::json::JsonValue;
use rocket_json::{Error, Result};
fn example(error: bool) -> Result<JsonValue> {
if error {
// Rocket will return status code 503:
// { "reason": "Service Unavailable", "status": 503 }
return Err(Error::ServiceUnavailable);
}
// Rocket will return status code 200:
// { "example": 42 }
Ok(json!({ "example": 42 }))
}Aliased Type§
enum Result<R> {
Ok(R),
Err(Error),
}