pub struct HttpResponse { /* private fields */ }Expand description
A validated HTTP response owned by the application.
Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn new<B: Into<Vec<u8>>>(status: u16, body: B) -> Result<Self>
pub fn new<B: Into<Vec<u8>>>(status: u16, body: B) -> Result<Self>
Construct a response with a status and body.
§Errors
Returns io::ErrorKind::InvalidInput when status is not a final
three-digit HTTP status code.
Sourcepub fn set_header<N: Into<String>, V: Into<String>>(
&mut self,
name: N,
value: V,
) -> Result<()>
pub fn set_header<N: Into<String>, V: Into<String>>( &mut self, name: N, value: V, ) -> Result<()>
Add one application response header.
Content-Length, Connection, and Transfer-Encoding are transport
owned and cannot be overridden.
§Errors
Returns io::ErrorKind::InvalidInput for an invalid, reserved, or
duplicate header.
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Source§impl Debug for HttpResponse
impl Debug for HttpResponse
impl Eq for HttpResponse
Source§impl PartialEq for HttpResponse
impl PartialEq for HttpResponse
impl StructuralPartialEq for HttpResponse
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponse
impl UnwindSafe for HttpResponse
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