pub struct ErrorResponse {
pub status: StatusCode,
pub header: ErrorResponseHeader,
pub body: Box<PaymentRequired>,
}Expand description
Represents an error response from the paywall.
Fields§
§status: StatusCodeThe HTTP status code of the error response.
header: ErrorResponseHeaderThe header to include in the error response.
body: Box<PaymentRequired>The body of the error response.
Body is Boxed to reduce size of the struct.
Implementations§
Source§impl ErrorResponse
impl ErrorResponse
Sourcepub fn payment_required(
resource: PaymentResource,
accepts: Accepts,
extensions: HashMap<String, Extension>,
) -> ErrorResponse
pub fn payment_required( resource: PaymentResource, accepts: Accepts, extensions: HashMap<String, Extension>, ) -> ErrorResponse
Payment needed to access resource
Sourcepub fn invalid_payment(
reason: impl Display,
resource: PaymentResource,
accepts: Accepts,
extensions: HashMap<String, Extension>,
) -> ErrorResponse
pub fn invalid_payment( reason: impl Display, resource: PaymentResource, accepts: Accepts, extensions: HashMap<String, Extension>, ) -> ErrorResponse
Malformed payment payload or requirements
Sourcepub fn payment_failed(
reason: impl Display,
resource: PaymentResource,
accepts: Accepts,
extensions: HashMap<String, Extension>,
) -> ErrorResponse
pub fn payment_failed( reason: impl Display, resource: PaymentResource, accepts: Accepts, extensions: HashMap<String, Extension>, ) -> ErrorResponse
Payment verification or settlement failed
Sourcepub fn server_error(
reason: impl Display,
resource: PaymentResource,
accepts: Accepts,
extensions: HashMap<String, Extension>,
) -> ErrorResponse
pub fn server_error( reason: impl Display, resource: PaymentResource, accepts: Accepts, extensions: HashMap<String, Extension>, ) -> ErrorResponse
Internal server error during payment processing
Trait Implementations§
Source§impl Clone for ErrorResponse
impl Clone for ErrorResponse
Source§fn clone(&self) -> ErrorResponse
fn clone(&self) -> ErrorResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorResponse
impl Debug for ErrorResponse
Source§impl IntoResponse for ErrorResponse
Available on crate feature axum only.
impl IntoResponse for ErrorResponse
Available on crate feature
axum only.Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Create a response.
Auto Trait Implementations§
impl Freeze for ErrorResponse
impl RefUnwindSafe for ErrorResponse
impl Send for ErrorResponse
impl Sync for ErrorResponse
impl Unpin for ErrorResponse
impl UnwindSafe for ErrorResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService which stores information
about the incoming connection and has no state. Read moreSource§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>
Converts
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>
Converts
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