pub struct Response<T> {
pub http_code: u16,
pub code: i64,
pub message: String,
pub data: Option<T>,
pub builder: Option<ResponseBuilderFn>,
pub translate: bool,
}
Available on crate feature
response
only.Fields§
§http_code: u16
§code: i64
§message: String
§data: Option<T>
§builder: Option<ResponseBuilderFn>
§translate: bool
Available on crate feature
i18n
only.Implementations§
Source§impl<T> Response<T>
impl<T> Response<T>
pub fn new<C>(r: C) -> Selfwhere
C: ResponseCodeTrait,
pub fn new_code(code: u16) -> Self
pub fn bad_request<S: Into<String>>(s: S) -> Self
pub fn not_found() -> Self
pub fn builder<F>(self, f: F) -> Selfwhere
F: Fn(&mut HttpResponseBuilder) + 'static,
pub fn message<S: Into<String>>(self, s: S) -> Self
pub fn data(self, data: T) -> Self
pub fn file(name: String, data: Vec<u8>) -> HttpResponse
pub fn translate(self) -> Self
Available on crate feature
i18n
only.pub fn i18n_message(&self, req: &HttpRequest) -> String
Available on crate feature
i18n
only.Auto Trait Implementations§
impl<T> Freeze for Response<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Response<T>
impl<T> !Send for Response<T>
impl<T> !Sync for Response<T>
impl<T> Unpin for Response<T>where
T: Unpin,
impl<T> !UnwindSafe for Response<T>
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