Struct KnownWebError

Source
pub struct KnownWebError { /* private fields */ }
Expand description

Implementations§

Source§

impl KnownWebError

Source

pub fn new<S: Into<String>>(status_code: StatusCode, msg: S) -> Self

Source

pub fn ok<S: Into<String>>(msg: S) -> Self

Source

pub fn created<S: Into<String>>(msg: S) -> Self

201 Created [RFC7231, Section 6.3.2]

Source

pub fn accepted<S: Into<String>>(msg: S) -> Self

202 Accepted [RFC7231, Section 6.3.3]

Source

pub fn non_authoritative_information<S: Into<String>>(msg: S) -> Self

203 Non-Authoritative Information [RFC7231, Section 6.3.4]

Source

pub fn no_content<S: Into<String>>(msg: S) -> Self

204 No Content [RFC7231, Section 6.3.5]

Source

pub fn reset_content<S: Into<String>>(msg: S) -> Self

205 Reset Content [RFC7231, Section 6.3.6]

Source

pub fn partial_content<S: Into<String>>(msg: S) -> Self

206 Partial Content [RFC7233, Section 4.1]

Source

pub fn multi_status<S: Into<String>>(msg: S) -> Self

207 Multi-Status [RFC4918]

Source

pub fn already_reported<S: Into<String>>(msg: S) -> Self

208 Already Reported [RFC5842]

Source

pub fn im_used<S: Into<String>>(msg: S) -> Self

226 IM Used [RFC3229]

Source

pub fn multiple_choices<S: Into<String>>(msg: S) -> Self

300 Multiple Choices [RFC7231, Section 6.4.1]

Source

pub fn moved_permanently<S: Into<String>>(msg: S) -> Self

301 Moved Permanently [RFC7231, Section 6.4.2]

Source

pub fn found<S: Into<String>>(msg: S) -> Self

Source

pub fn see_other<S: Into<String>>(msg: S) -> Self

303 See Other [RFC7231, Section 6.4.4]

Source

pub fn not_modified<S: Into<String>>(msg: S) -> Self

304 Not Modified [RFC7232, Section 4.1]

Source

pub fn use_proxy<S: Into<String>>(msg: S) -> Self

305 Use Proxy [RFC7231, Section 6.4.5]

Source

pub fn temporary_redirect<S: Into<String>>(msg: S) -> Self

307 Temporary Redirect [RFC7231, Section 6.4.7]

Source

pub fn permanent_redirect<S: Into<String>>(msg: S) -> Self

308 Permanent Redirect [RFC7238]

Source

pub fn bad_request<S: Into<String>>(msg: S) -> Self

400 Bad Request [RFC7231, Section 6.5.1]

Source

pub fn unauthorized<S: Into<String>>(msg: S) -> Self

401 Unauthorized [RFC7235, Section 3.1]

Source

pub fn payment_required<S: Into<String>>(msg: S) -> Self

402 Payment Required [RFC7231, Section 6.5.2]

Source

pub fn forbidden<S: Into<String>>(msg: S) -> Self

403 Forbidden [RFC7231, Section 6.5.3]

Source

pub fn not_found<S: Into<String>>(msg: S) -> Self

404 Not Found [RFC7231, Section 6.5.4]

Source

pub fn method_not_allowed<S: Into<String>>(msg: S) -> Self

405 Method Not Allowed [RFC7231, Section 6.5.5]

Source

pub fn not_acceptable<S: Into<String>>(msg: S) -> Self

406 Not Acceptable [RFC7231, Section 6.5.6]

Source

pub fn proxy_authentication_required<S: Into<String>>(msg: S) -> Self

407 Proxy Authentication Required [RFC7235, Section 3.2]

Source

pub fn request_timeout<S: Into<String>>(msg: S) -> Self

408 Request Timeout [RFC7231, Section 6.5.7]

Source

pub fn conflict<S: Into<String>>(msg: S) -> Self

409 Conflict [RFC7231, Section 6.5.8]

Source

pub fn gone<S: Into<String>>(msg: S) -> Self

Source

pub fn length_required<S: Into<String>>(msg: S) -> Self

411 Length Required [RFC7231, Section 6.5.10]

Source

pub fn precondition_failed<S: Into<String>>(msg: S) -> Self

412 Precondition Failed [RFC7232, Section 4.2]

Source

pub fn payload_too_large<S: Into<String>>(msg: S) -> Self

413 Payload Too Large [RFC7231, Section 6.5.11]

Source

pub fn uri_too_long<S: Into<String>>(msg: S) -> Self

414 URI Too Long [RFC7231, Section 6.5.12]

Source

pub fn unsupported_media_type<S: Into<String>>(msg: S) -> Self

415 Unsupported Media Type [RFC7231, Section 6.5.13]

Source

pub fn range_not_satisfiable<S: Into<String>>(msg: S) -> Self

416 Range Not Satisfiable [RFC7233, Section 4.4]

Source

pub fn expectation_failed<S: Into<String>>(msg: S) -> Self

417 Expectation Failed [RFC7231, Section 6.5.14]

Source

pub fn im_a_teapot<S: Into<String>>(msg: S) -> Self

418 I’m a teapot [curiously not registered by IANA but RFC2324]

Source

pub fn misdirected_request<S: Into<String>>(msg: S) -> Self

421 Misdirected Request RFC7540, Section 9.1.2

Source

pub fn unprocessable_entity<S: Into<String>>(msg: S) -> Self

422 Unprocessable Entity [RFC4918]

Source

pub fn locked<S: Into<String>>(msg: S) -> Self

423 Locked [RFC4918]

Source

pub fn failed_dependency<S: Into<String>>(msg: S) -> Self

424 Failed Dependency [RFC4918]

Source

pub fn upgrade_required<S: Into<String>>(msg: S) -> Self

426 Upgrade Required [RFC7231, Section 6.5.15]

Source

pub fn precondition_required<S: Into<String>>(msg: S) -> Self

428 Precondition Required [RFC6585]

Source

pub fn too_many_requests<S: Into<String>>(msg: S) -> Self

429 Too Many Requests [RFC6585]

Source

pub fn request_header_fields_too_large<S: Into<String>>(msg: S) -> Self

431 Request Header Fields Too Large [RFC6585]

451 Unavailable For Legal Reasons [RFC7725]

Source

pub fn internal_server_error<S: Into<String>>(msg: S) -> Self

500 Internal Server Error [RFC7231, Section 6.6.1]

Source

pub fn not_implemented<S: Into<String>>(msg: S) -> Self

501 Not Implemented [RFC7231, Section 6.6.2]

Source

pub fn bad_gateway<S: Into<String>>(msg: S) -> Self

502 Bad Gateway [RFC7231, Section 6.6.3]

Source

pub fn service_unavailable<S: Into<String>>(msg: S) -> Self

503 Service Unavailable [RFC7231, Section 6.6.4]

Source

pub fn gateway_timeout<S: Into<String>>(msg: S) -> Self

504 Gateway Timeout [RFC7231, Section 6.6.5]

Source

pub fn http_version_not_supported<S: Into<String>>(msg: S) -> Self

505 HTTP Version Not Supported [RFC7231, Section 6.6.6]

Source

pub fn variant_also_negotiates<S: Into<String>>(msg: S) -> Self

506 Variant Also Negotiates [RFC2295]

Source

pub fn insufficient_storage<S: Into<String>>(msg: S) -> Self

507 Insufficient Storage [RFC4918]

Source

pub fn loop_detected<S: Into<String>>(msg: S) -> Self

508 Loop Detected [RFC5842]

Source

pub fn not_extended<S: Into<String>>(msg: S) -> Self

510 Not Extended [RFC2774]

Source

pub fn network_authentication_required<S: Into<String>>(msg: S) -> Self

511 Network Authentication Required [RFC6585]

Trait Implementations§

Source§

impl Debug for KnownWebError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for KnownWebError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for KnownWebError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<KnownWebError> for WebError

Source§

fn from(source: KnownWebError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.

Source§

impl<T> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<E> InstrumentError for E
where TracedError<E>: From<E>,

Source§

type Instrumented = TracedError<E>

The type of the wrapped error after instrumentation
Source§

fn in_current_span(self) -> <E as InstrumentError>::Instrumented

Instrument an Error by bundling it with a SpanTrace 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ServiceExt for T

Source§

fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>
where Self: Sized,

Propagate a header from the request to the response. Read more
Source§

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Add some shareable value to request extensions. Read more
Source§

fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>
where Self: Sized,

Apply a transformation to the request body. Read more
Source§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
Source§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
Source§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
Source§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
Source§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Mark headers as sensitive on both requests and responses. Read more
Source§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Mark headers as sensitive on requests. Read more
Source§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Mark headers as sensitive on responses. Read more
Source§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
Source§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
Source§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
Source§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
Source§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
Source§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
Source§

fn set_request_id<M>( self, header_name: HeaderName, make_request_id: M, ) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Add request id header and extension. Read more
Source§

fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Add request id header and extension, using x-request-id as the header name. Read more
Source§

fn propagate_request_id( self, header_name: HeaderName, ) -> PropagateRequestId<Self>
where Self: Sized,

Propgate request ids from requests to responses. Read more
Source§

fn propagate_x_request_id(self) -> PropagateRequestId<Self>
where Self: Sized,

Propgate request ids from requests to responses, using x-request-id as the header name. Read more
Source§

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Catch panics and convert them into 500 Internal Server responses. Read more
Source§

fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>
where Self: Sized,

Intercept requests with over-sized payloads and convert them into 413 Payload Too Large responses. Read more
Source§

fn trim_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Remove trailing slashes from paths. Read more
Source§

fn append_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Append trailing slash to paths. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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