[−][src]Struct rocket_json::error::Error
A specialized Status
struct that responds json errors.
This struct implements a Responder
that will return json.
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 })) }
Methods
impl Error
[src]
pub const BadRequest: Error
[src]
pub const Unauthorized: Error
[src]
pub const PaymentRequired: Error
[src]
pub const Forbidden: Error
[src]
pub const NotFound: Error
[src]
pub const MethodNotAllowed: Error
[src]
pub const NotAcceptable: Error
[src]
pub const ProxyAuthenticationRequired: Error
[src]
pub const RequestTimeout: Error
[src]
pub const Conflict: Error
[src]
pub const Gone: Error
[src]
pub const LengthRequired: Error
[src]
pub const PreconditionFailed: Error
[src]
pub const PayloadTooLarge: Error
[src]
pub const UriTooLong: Error
[src]
pub const UnsupportedMediaType: Error
[src]
pub const RangeNotSatisfiable: Error
[src]
pub const ExpectationFailed: Error
[src]
pub const ImATeapot: Error
[src]
pub const MisdirectedRequest: Error
[src]
pub const UnprocessableEntity: Error
[src]
pub const Locked: Error
[src]
pub const FailedDependency: Error
[src]
pub const UpgradeRequired: Error
[src]
pub const PreconditionRequired: Error
[src]
pub const TooManyRequests: Error
[src]
pub const RequestHeaderFieldsTooLarge: Error
[src]
pub const UnavailableForLegalReasons: Error
[src]
pub const InternalServerError: Error
[src]
pub const NotImplemented: Error
[src]
pub const BadGateway: Error
[src]
pub const ServiceUnavailable: Error
[src]
pub const GatewayTimeout: Error
[src]
pub const HttpVersionNotSupported: Error
[src]
pub const VariantAlsoNegotiates: Error
[src]
pub const InsufficientStorage: Error
[src]
pub const LoopDetected: Error
[src]
pub const NotExtended: Error
[src]
pub const NetworkAuthenticationRequired: Error
[src]
Trait Implementations
impl Eq for Error
[src]
impl AsMut<Status> for Error
[src]
impl PartialEq<Error> for Error
[src]
impl Copy for Error
[src]
impl Clone for Error
[src]
fn clone(&self) -> Error
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl AsRef<Status> for Error
[src]
impl From<Status> for Error
[src]
impl Debug for Error
[src]
impl Hash for Error
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'r> Responder<'r> for Error
[src]
fn respond_to(self, req: &Request) -> Result<Response<'r>, Status>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,