[][src]Struct rocket_json_response::JSONResponse

pub struct JSONResponse<'a, T: ToJSON = JSONGetTextValue<'a>> {
    pub code: Box<dyn JSONResponseCode>,
    pub data: T,
    // some fields omitted
}

To respond JSON data.

The format of JSON data looks like,

{
   code: <integer>,
   data: <json value>
}

Fields

code: Box<dyn JSONResponseCode>data: T

Methods

impl<'a, T: ToJSON> JSONResponse<'a, T>[src]

pub fn ok(data: T) -> Self[src]

pub fn err<K: JSONResponseCode + 'static>(code: K, data: T) -> Self[src]

Trait Implementations

impl<'a, T: ToJSON> Debug for JSONResponse<'a, T>[src]

impl<'a, T: ToJSON> Responder<'a> for JSONResponse<'a, T>[src]

Auto Trait Implementations

impl<'a, T = JSONGetTextValue<'a>> !Send for JSONResponse<'a, T>

impl<'a, T = JSONGetTextValue<'a>> !Sync for JSONResponse<'a, T>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,