pub struct Response { /* private fields */ }Expand description
HTTP response
Implementations
sourceimpl Response
impl Response
pub fn builder<S>(status: S) -> ResponseBuilder where
S: TryInto<StatusCode>,
S::Error: Debug,
pub fn status(&self) -> StatusCode
pub fn set_status<S>(&mut self, status: S) where
S: TryInto<StatusCode>,
S::Error: Debug,
pub fn len(&self) -> Option<usize>
pub fn is_empty(&self) -> Option<bool>
pub fn header(&self, name: impl Into<HeaderName>) -> Option<&HeaderValues>
pub fn header_mut(
&mut self,
name: impl Into<HeaderName>
) -> Option<&mut HeaderValues>
pub fn remove_header(
&mut self,
name: impl Into<HeaderName>
) -> Option<HeaderValues>
pub fn insert_header(
&mut self,
key: impl Into<HeaderName>,
value: impl ToHeaderValues
)
pub fn append_header(
&mut self,
key: impl Into<HeaderName>,
value: impl ToHeaderValues
)
pub fn iter(&self) -> Iter<'_>
pub fn iter_mut(&mut self) -> IterMut<'_>
pub fn header_names(&self) -> Names<'_>
pub fn header_values(&self) -> Values<'_>
pub fn content_type(&self) -> Option<Mime>
pub fn set_content_type(&mut self, mime: impl Into<Mime>)
pub fn take_body(&mut self) -> Body
pub fn swap_body(&mut self, body: &mut Body)
pub fn body_json(&mut self, json: &impl Serialize) -> Result<()>
pub fn body_string(&mut self, string: String)
pub fn body_bytes(&mut self, bytes: impl AsRef<[u8]>)
pub async fn body_file(&mut self, path: impl AsRef<Path>) -> Result<()>
pub fn error(&self) -> Option<&Error>
pub fn downcast_error<E>(&self) -> Option<&E> where
E: Display + Debug + Send + Sync + 'static,
pub fn take_error(&mut self) -> Option<Error>
pub fn set_error(&mut self, error: impl Into<Error>)
pub fn ext<T: Send + Sync + 'static>(&self) -> Option<&T>
pub fn insert_ext<T: Send + Sync + 'static>(&mut self, val: T)
pub fn from_res<T>(value: T) -> Self where
T: Into<Response>,
Trait Implementations
sourceimpl From<ResponseBuilder> for Response
impl From<ResponseBuilder> for Response
sourcefn from(response_builder: ResponseBuilder) -> Response
fn from(response_builder: ResponseBuilder) -> Response
Converts to this type from the input type.
sourceimpl From<StatusCode> for Response
impl From<StatusCode> for Response
sourcefn from(status: StatusCode) -> Self
fn from(status: StatusCode) -> Self
Converts to this type from the input type.
sourceimpl Index<&str> for Response
impl Index<&str> for Response
type Output = HeaderValues
type Output = HeaderValues
The returned type after indexing.
sourcefn index(&self, name: &str) -> &HeaderValues
fn index(&self, name: &str) -> &HeaderValues
Performs the indexing (container[index]) operation. Read more
sourceimpl Index<HeaderName> for Response
impl Index<HeaderName> for Response
type Output = HeaderValues
type Output = HeaderValues
The returned type after indexing.
sourcefn index(&self, name: HeaderName) -> &HeaderValues
fn index(&self, name: HeaderName) -> &HeaderValues
Performs the indexing (container[index]) operation. Read more
sourceimpl IntoIterator for Response
impl IntoIterator for Response
type Item = (HeaderName, HeaderValues)
type Item = (HeaderName, HeaderValues)
The type of the elements being iterated over.
sourceimpl<'a> IntoIterator for &'a Response
impl<'a> IntoIterator for &'a Response
type Item = (&'a HeaderName, &'a HeaderValues)
type Item = (&'a HeaderName, &'a HeaderValues)
The type of the elements being iterated over.
sourceimpl<'a> IntoIterator for &'a mut Response
impl<'a> IntoIterator for &'a mut Response
type Item = (&'a HeaderName, &'a mut HeaderValues)
type Item = (&'a HeaderName, &'a mut HeaderValues)
The type of the elements being iterated over.
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more