pub struct Answer<'a, T> { /* private fields */ }Expand description
Strict answer to complain with generated code by cargo-swagg
Implementations§
Source§impl<'a, T: Serialize> Answer<'a, T>
impl<'a, T: Serialize> Answer<'a, T>
pub fn new(response: T) -> Answer<'a, T>
Sourcepub fn header<V>(self, key: String, value: V) -> Selfwhere
V: TryIntoHeaderValue,
pub fn header<V>(self, key: String, value: V) -> Selfwhere
V: TryIntoHeaderValue,
Set header to answer
Add cookie to answer
Sourcepub fn status(self, status: StatusCode) -> Self
pub fn status(self, status: StatusCode) -> Self
Set status code
Sourcepub fn content_type(self, content_type: Option<ContentType>) -> Self
pub fn content_type(self, content_type: Option<ContentType>) -> Self
Set content-type Content-Type changes serializer for answer
Trait Implementations§
Source§impl<'a, T: Serialize> Responder for Answer<'a, T>
impl<'a, T: Serialize> Responder for Answer<'a, T>
type Body = BoxBody
Source§fn respond_to(self, _: &HttpRequest) -> HttpResponse
fn respond_to(self, _: &HttpRequest) -> HttpResponse
Convert self to
HttpResponse.Auto Trait Implementations§
impl<'a, T> Freeze for Answer<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Answer<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Answer<'a, T>where
T: Send,
impl<'a, T> Sync for Answer<'a, T>where
T: Sync,
impl<'a, T> Unpin for Answer<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Answer<'a, 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