paperclip_actix::web

Struct HttpResponse

pub struct HttpResponse<B = BoxBody> { /* private fields */ }
Expand description

An outgoing response.

Implementations§

§

impl HttpResponse

pub fn Continue() -> HttpResponseBuilder

pub fn SwitchingProtocols() -> HttpResponseBuilder

pub fn Processing() -> HttpResponseBuilder

pub fn Ok() -> HttpResponseBuilder

pub fn Created() -> HttpResponseBuilder

pub fn Accepted() -> HttpResponseBuilder

pub fn NonAuthoritativeInformation() -> HttpResponseBuilder

pub fn NoContent() -> HttpResponseBuilder

pub fn ResetContent() -> HttpResponseBuilder

pub fn PartialContent() -> HttpResponseBuilder

pub fn MultiStatus() -> HttpResponseBuilder

pub fn AlreadyReported() -> HttpResponseBuilder

pub fn ImUsed() -> HttpResponseBuilder

pub fn MultipleChoices() -> HttpResponseBuilder

pub fn MovedPermanently() -> HttpResponseBuilder

pub fn Found() -> HttpResponseBuilder

pub fn SeeOther() -> HttpResponseBuilder

pub fn NotModified() -> HttpResponseBuilder

pub fn UseProxy() -> HttpResponseBuilder

pub fn TemporaryRedirect() -> HttpResponseBuilder

pub fn PermanentRedirect() -> HttpResponseBuilder

pub fn BadRequest() -> HttpResponseBuilder

pub fn Unauthorized() -> HttpResponseBuilder

pub fn PaymentRequired() -> HttpResponseBuilder

pub fn Forbidden() -> HttpResponseBuilder

pub fn NotFound() -> HttpResponseBuilder

pub fn MethodNotAllowed() -> HttpResponseBuilder

pub fn NotAcceptable() -> HttpResponseBuilder

pub fn ProxyAuthenticationRequired() -> HttpResponseBuilder

pub fn RequestTimeout() -> HttpResponseBuilder

pub fn Conflict() -> HttpResponseBuilder

pub fn Gone() -> HttpResponseBuilder

pub fn LengthRequired() -> HttpResponseBuilder

pub fn PreconditionFailed() -> HttpResponseBuilder

pub fn PayloadTooLarge() -> HttpResponseBuilder

pub fn UriTooLong() -> HttpResponseBuilder

pub fn UnsupportedMediaType() -> HttpResponseBuilder

pub fn RangeNotSatisfiable() -> HttpResponseBuilder

pub fn ExpectationFailed() -> HttpResponseBuilder

pub fn ImATeapot() -> HttpResponseBuilder

pub fn MisdirectedRequest() -> HttpResponseBuilder

pub fn UnprocessableEntity() -> HttpResponseBuilder

pub fn Locked() -> HttpResponseBuilder

pub fn FailedDependency() -> HttpResponseBuilder

pub fn UpgradeRequired() -> HttpResponseBuilder

pub fn PreconditionRequired() -> HttpResponseBuilder

pub fn TooManyRequests() -> HttpResponseBuilder

pub fn RequestHeaderFieldsTooLarge() -> HttpResponseBuilder

pub fn UnavailableForLegalReasons() -> HttpResponseBuilder

pub fn InternalServerError() -> HttpResponseBuilder

pub fn NotImplemented() -> HttpResponseBuilder

pub fn BadGateway() -> HttpResponseBuilder

pub fn ServiceUnavailable() -> HttpResponseBuilder

pub fn GatewayTimeout() -> HttpResponseBuilder

pub fn VersionNotSupported() -> HttpResponseBuilder

pub fn VariantAlsoNegotiates() -> HttpResponseBuilder

pub fn InsufficientStorage() -> HttpResponseBuilder

pub fn LoopDetected() -> HttpResponseBuilder

pub fn NotExtended() -> HttpResponseBuilder

pub fn NetworkAuthenticationRequired() -> HttpResponseBuilder

§

impl HttpResponse

pub fn new(status: StatusCode) -> HttpResponse

Constructs a response.

pub fn build(status: StatusCode) -> HttpResponseBuilder

Constructs a response builder with specific HTTP status.

pub fn from_error(error: impl Into<Error>) -> HttpResponse

Create an error response.

§

impl<B> HttpResponse<B>

pub fn with_body(status: StatusCode, body: B) -> HttpResponse<B>

Constructs a response with body

pub fn head(&self) -> &ResponseHead

Returns a reference to response head.

pub fn head_mut(&mut self) -> &mut ResponseHead

Returns a mutable reference to response head.

pub fn error(&self) -> Option<&Error>

The source error for this response

pub fn status(&self) -> StatusCode

Get the response status code

pub fn status_mut(&mut self) -> &mut StatusCode

Set the StatusCode for this response

pub fn headers(&self) -> &HeaderMap

Get the headers from the response

pub fn headers_mut(&mut self) -> &mut HeaderMap

Get a mutable reference to the headers

pub fn upgrade(&self) -> bool

Connection upgrade status

pub fn keep_alive(&self) -> bool

Keep-alive status for this connection

pub fn extensions(&self) -> Ref<'_, Extensions>

Returns reference to the response-local data/extensions container.

pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions>

Returns reference to the response-local data/extensions container.

pub fn body(&self) -> &B

Returns a reference to this response’s body.

pub fn set_body<B2>(self, body: B2) -> HttpResponse<B2>

Sets new body.

pub fn into_parts(self) -> (HttpResponse<()>, B)

Returns split head and body.

§Implementation Notes

Due to internal performance optimizations, the first element of the returned tuple is an HttpResponse as well but only contains the head of the response this was called on.

pub fn drop_body(self) -> HttpResponse<()>

Drops body and returns new response.

pub fn map_body<F, B2>(self, f: F) -> HttpResponse<B2>
where F: FnOnce(&mut ResponseHead, B) -> B2,

Map the current body type to another using a closure, returning a new response.

Closure receives the response head and the current body type.

pub fn map_into_left_body<R>(self) -> HttpResponse<EitherBody<B, R>>

Map the current body type B to EitherBody::Left(B).

Useful for middleware which can generate their own responses.

pub fn map_into_right_body<L>(self) -> HttpResponse<EitherBody<L, B>>

Map the current body type B to EitherBody::Right(B).

Useful for middleware which can generate their own responses.

pub fn map_into_boxed_body(self) -> HttpResponse
where B: MessageBody + 'static,

Map the current body to a type-erased BoxBody.

pub fn into_body(self) -> B

Returns the response body, dropping all other parts.

Trait Implementations§

§

impl Apiv2Schema for HttpResponse

§

fn name() -> Option<String>

Name of this schema. This is the name to which the definition of the object is mapped.
§

fn description() -> &'static str

Description of this schema. In case the trait is derived, uses the documentation on the type.
§

fn required() -> bool

Indicates the requirement of this schema.
§

fn raw_schema() -> DefaultSchemaRaw

Returns the raw schema for this object.
§

fn schema_with_ref() -> DefaultSchemaRaw

Returns the schema with a reference (if this is an object). Read more
§

fn security_scheme() -> Option<SecurityScheme>

Returns the security scheme for this object.
§

fn header_parameter_schema() -> Vec<Parameter<DefaultSchemaRaw>>

§

impl<B> Debug for HttpResponse<B>
where B: MessageBody,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<Error> for HttpResponse

§

fn from(err: Error) -> HttpResponse

Converts to this type from the input type.
§

impl From<HttpResponseBuilder> for HttpResponse

§

fn from(builder: HttpResponseBuilder) -> HttpResponse

Converts to this type from the input type.
§

impl<B> From<Response<B>> for HttpResponse<B>

§

fn from(res: Response<B>) -> HttpResponse<B>

Converts to this type from the input type.
§

impl<B> From<ServiceResponse<B>> for HttpResponse<B>

§

fn from(res: ServiceResponse<B>) -> HttpResponse<B>

Converts to this type from the input type.
§

impl OperationModifier for HttpResponse

§

fn update_parameter( op: &mut Operation<Parameter<DefaultSchemaRaw>, Response<DefaultSchemaRaw>>, )

Update the parameters list in the given operation (if needed).
§

fn update_response( _op: &mut Operation<Parameter<DefaultSchemaRaw>, Response<DefaultSchemaRaw>>, )

Update the responses map in the given operation (if needed).
§

fn update_definitions(map: &mut BTreeMap<String, DefaultSchemaRaw>)

Update the definitions map (if needed).
§

fn update_security( op: &mut Operation<Parameter<DefaultSchemaRaw>, Response<DefaultSchemaRaw>>, )

Update the security map in the given operation (if needed).
§

fn update_security_definitions(map: &mut BTreeMap<String, SecurityScheme>)

Update the security definition map (if needed).
§

impl<B> Responder for HttpResponse<B>
where B: MessageBody + 'static,

§

type Body = B

§

fn respond_to( self, _: &HttpRequest, ) -> HttpResponse<<HttpResponse<B> as Responder>::Body>

Convert self to HttpResponse.
§

fn customize(self) -> CustomizeResponder<Self>
where Self: Sized,

Wraps responder to allow alteration of its response. Read more

Auto Trait Implementations§

§

impl<B = BoxBody> !Freeze for HttpResponse<B>

§

impl<B = BoxBody> !RefUnwindSafe for HttpResponse<B>

§

impl<B = BoxBody> !Send for HttpResponse<B>

§

impl<B = BoxBody> !Sync for HttpResponse<B>

§

impl<B> Unpin for HttpResponse<B>
where B: Unpin,

§

impl<B = BoxBody> !UnwindSafe for HttpResponse<B>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more