pub struct Response<B = Body> { /* private fields */ }
Expand description
An HTTP Response
Implementations§
Source§impl Response
impl Response
pub fn Ok() -> ResponseBuilder ⓘ
pub fn Created() -> ResponseBuilder ⓘ
pub fn Accepted() -> ResponseBuilder ⓘ
pub fn NonAuthoritativeInformation() -> ResponseBuilder ⓘ
pub fn NoContent() -> ResponseBuilder ⓘ
pub fn ResetContent() -> ResponseBuilder ⓘ
pub fn PartialContent() -> ResponseBuilder ⓘ
pub fn MultiStatus() -> ResponseBuilder ⓘ
pub fn AlreadyReported() -> ResponseBuilder ⓘ
pub fn MultipleChoices() -> ResponseBuilder ⓘ
pub fn MovedPermanently() -> ResponseBuilder ⓘ
pub fn Found() -> ResponseBuilder ⓘ
pub fn SeeOther() -> ResponseBuilder ⓘ
pub fn NotModified() -> ResponseBuilder ⓘ
pub fn UseProxy() -> ResponseBuilder ⓘ
pub fn TemporaryRedirect() -> ResponseBuilder ⓘ
pub fn PermanentRedirect() -> ResponseBuilder ⓘ
pub fn BadRequest() -> ResponseBuilder ⓘ
pub fn NotFound() -> ResponseBuilder ⓘ
pub fn PaymentRequired() -> ResponseBuilder ⓘ
pub fn Forbidden() -> ResponseBuilder ⓘ
pub fn MethodNotAllowed() -> ResponseBuilder ⓘ
pub fn NotAcceptable() -> ResponseBuilder ⓘ
pub fn ProxyAuthenticationRequired() -> ResponseBuilder ⓘ
pub fn RequestTimeout() -> ResponseBuilder ⓘ
pub fn Conflict() -> ResponseBuilder ⓘ
pub fn Gone() -> ResponseBuilder ⓘ
pub fn LengthRequired() -> ResponseBuilder ⓘ
pub fn PreconditionFailed() -> ResponseBuilder ⓘ
pub fn PreconditionRequired() -> ResponseBuilder ⓘ
pub fn PayloadTooLarge() -> ResponseBuilder ⓘ
pub fn UriTooLong() -> ResponseBuilder ⓘ
pub fn UnsupportedMediaType() -> ResponseBuilder ⓘ
pub fn RangeNotSatisfiable() -> ResponseBuilder ⓘ
pub fn ExpectationFailed() -> ResponseBuilder ⓘ
pub fn UnprocessableEntity() -> ResponseBuilder ⓘ
pub fn TooManyRequests() -> ResponseBuilder ⓘ
pub fn InternalServerError() -> ResponseBuilder ⓘ
pub fn NotImplemented() -> ResponseBuilder ⓘ
pub fn BadGateway() -> ResponseBuilder ⓘ
pub fn GatewayTimeout() -> ResponseBuilder ⓘ
pub fn VersionNotSupported() -> ResponseBuilder ⓘ
pub fn VariantAlsoNegotiates() -> ResponseBuilder ⓘ
pub fn InsufficientStorage() -> ResponseBuilder ⓘ
pub fn LoopDetected() -> ResponseBuilder ⓘ
Source§impl Response<Body>
impl Response<Body>
Sourcepub fn build(status: StatusCode) -> ResponseBuilder ⓘ
pub fn build(status: StatusCode) -> ResponseBuilder ⓘ
Create http response builder with specific status.
Sourcepub fn build_from<T: Into<ResponseBuilder>>(source: T) -> ResponseBuilder ⓘ
pub fn build_from<T: Into<ResponseBuilder>>(source: T) -> ResponseBuilder ⓘ
Create http response builder
Sourcepub fn new(status: StatusCode) -> Response ⓘ
pub fn new(status: StatusCode) -> Response ⓘ
Constructs a response
Sourcepub fn from_error(error: Error) -> Response ⓘ
pub fn from_error(error: Error) -> Response ⓘ
Constructs an error response
Source§impl<B> Response<B>
impl<B> Response<B>
Sourcepub fn with_body(status: StatusCode, body: B) -> Response<B> ⓘ
pub fn with_body(status: StatusCode, body: B) -> Response<B> ⓘ
Constructs a response with body
Sourcepub fn head(&self) -> &ResponseHead
pub fn head(&self) -> &ResponseHead
Http message part of the response
Sourcepub fn head_mut(&mut self) -> &mut ResponseHead
pub fn head_mut(&mut self) -> &mut ResponseHead
Mutable reference to a http message part of the response
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the response status code
Sourcepub fn status_mut(&mut self) -> &mut StatusCode
pub fn status_mut(&mut self) -> &mut StatusCode
Set the StatusCode
for this response
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Get a mutable reference to the headers
Get an iterator for the cookies set by this response
Add a cookie to this response
Remove all cookies with the given name from this response. Returns the number of cookies removed.
Sourcepub fn keep_alive(&self) -> bool
pub fn keep_alive(&self) -> bool
Keep-alive status for this connection
Sourcepub fn extensions(&self) -> Ref<'_, Extensions>
pub fn extensions(&self) -> Ref<'_, Extensions>
Responses extensions
Sourcepub fn extensions_mut(&mut self) -> RefMut<'_, Extensions>
pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions>
Mutable reference to a the response’s extensions
Sourcepub fn body(&self) -> &ResponseBody<B>
pub fn body(&self) -> &ResponseBody<B>
Get body of this response
Sourcepub fn into_parts(self) -> (Response<()>, ResponseBody<B>)
pub fn into_parts(self) -> (Response<()>, ResponseBody<B>)
Split response and body
Sourcepub fn take_body(&mut self) -> ResponseBody<B>
pub fn take_body(&mut self) -> ResponseBody<B>
Extract response body
Trait Implementations§
Source§impl<B: MessageBody> Debug for Response<B>
impl<B: MessageBody> Debug for Response<B>
Source§impl<B> From<Response<B>> for ResponseBuilder
Convert Response
to a ResponseBuilder
. Body get dropped.
impl<B> From<Response<B>> for ResponseBuilder
Convert Response
to a ResponseBuilder
. Body get dropped.
Source§impl From<ResponseBuilder> for Response
impl From<ResponseBuilder> for Response
Source§fn from(builder: ResponseBuilder) -> Self
fn from(builder: ResponseBuilder) -> Self
Auto Trait Implementations§
impl<B = Body> !Freeze for Response<B>
impl<B = Body> !RefUnwindSafe for Response<B>
impl<B = Body> !Send for Response<B>
impl<B = Body> !Sync for Response<B>
impl<B> Unpin for Response<B>
impl<B = Body> !UnwindSafe for Response<B>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more