pub struct JsonResponse<T: Serialize> {
pub value: T,
pub status_code: Option<StatusCode>,
}
Fields§
§value: T
§status_code: Option<StatusCode>
Implementations§
Source§impl<T: Serialize> JsonResponse<T>
impl<T: Serialize> JsonResponse<T>
pub fn with_status_code(self, status_code: StatusCode) -> Self
Trait Implementations§
Source§impl<T: Serialize> From<T> for JsonResponse<T>
impl<T: Serialize> From<T> for JsonResponse<T>
Source§impl<T: Serialize> Responder for JsonResponse<T>
impl<T: Serialize> Responder for JsonResponse<T>
type Body = BoxBody
Source§fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>
fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>
Convert self to
HttpResponse
.Auto Trait Implementations§
impl<T> Freeze for JsonResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for JsonResponse<T>where
T: RefUnwindSafe,
impl<T> Send for JsonResponse<T>where
T: Send,
impl<T> Sync for JsonResponse<T>where
T: Sync,
impl<T> Unpin for JsonResponse<T>where
T: Unpin,
impl<T> UnwindSafe for JsonResponse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more