Skip to main content

ContentErrorKind

Enum ContentErrorKind 

Source
#[non_exhaustive]
pub enum ContentErrorKind {
Show 23 variants MissingMediaType, UnsupportedMediaType, UnacceptedFormat, UnsupportedCharset, BodySizeLimit, PreambleSizeLimit, EpilogueSizeLimit, HeaderSizeLimit, HeaderCountLimit, PartCountLimit, PairCountLimit, DepthLimit, CountLimit, FieldSizeLimit, ContentSizeLimit, UnknownName, InvalidBoundary, MissingName, InvalidPartHeader, EmptyFilenameContent, UnexpectedEnd, MalformedMultipart, MalformedUrlEncoded,
}
Expand description

The kind of ContentError.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MissingMediaType

The request has no media type. 415 Unsupported Media Type.

§

UnsupportedMediaType

The request’s media type is not a format this crate parses. 415 Unsupported Media Type.

§

UnacceptedFormat

The declaration does not accept the request’s format. 415 Unsupported Media Type.

§

UnsupportedCharset

An application/x-www-form-urlencoded media type declares a charset other than UTF-8 or US-ASCII. 415 Unsupported Media Type.

§

BodySizeLimit

The body is longer than the largest the declaration could need, Content::body_size_limit. 413 Content Too Large.

§

PreambleSizeLimit

The bytes before a multipart/form-data body’s first boundary exceed the preamble limit. 413 Content Too Large.

§

EpilogueSizeLimit

The bytes after a multipart/form-data body’s closing boundary line exceed the epilogue limit. 413 Content Too Large.

§

HeaderSizeLimit

A part’s header section, with any padding after its boundary, exceeds the header section limit. 413 Content Too Large.

§

HeaderCountLimit

A part’s header section has more fields than the header count limit. 413 Content Too Large.

§

PartCountLimit

The body has more parts than the part count limit. 413 Content Too Large.

§

PairCountLimit

An application/x-www-form-urlencoded body has more pairs than the pair count limit. 413 Content Too Large.

§

DepthLimit

A name has more components than the depth limit. 413 Content Too Large.

§

CountLimit

An array has more elements than its count limit. 413 Content Too Large.

§

FieldSizeLimit

A field or upload has more content than its size limit. 413 Content Too Large.

§

ContentSizeLimit

The fields and uploads together have more content than the total content limit. 413 Content Too Large.

§

UnknownName

A name is not one the declaration accepts, including a name that is not base, base[key], or base[], repeated. 400 Bad Request.

§

InvalidBoundary

A multipart/form-data media type has no boundary parameter, or one RFC 2046 does not allow. 400 Bad Request.

§

MissingName

A part’s Content-Disposition is missing, is not form-data, or has no name. 400 Bad Request.

§

InvalidPartHeader

A part’s header fields cannot be read: a header line is malformed or folded, a Content-Disposition or Content-Type is invalid or repeated, its parameters break the ParameterRules, or its Content-Transfer-Encoding is not an identity encoding. 400 Bad Request.

§

EmptyFilenameContent

A part for a declared upload has an empty filename, which browsers send for a file input with no file chosen, yet has content. 400 Bad Request.

§

UnexpectedEnd

The content ended before it was complete: a multipart body before its closing boundary, or URL-encoded content whose end was not given to ContentParser::parse_end. 400 Bad Request.

§

MalformedMultipart

The multipart framing is malformed, as base-web-multipart reports it, such as a boundary line that does not end with a line break, or a boundary after a bare CR or LF. 400 Bad Request.

§

MalformedUrlEncoded

URL-encoded content is malformed, as base-web-url reports it: a % not followed by two hexadecimal digits, or decoded text that is not UTF-8. 400 Bad Request.

Implementations§

Source§

impl ContentErrorKind

Source

pub fn status(self) -> u16

The HTTP status a server should respond with: 415, 413, or 400.

use base_web_content::ContentErrorKind;

assert_eq!(ContentErrorKind::FieldSizeLimit.status(), 413);

Trait Implementations§

Source§

impl Clone for ContentErrorKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ContentErrorKind

Source§

impl Debug for ContentErrorKind

Source§

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

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

impl Eq for ContentErrorKind

Source§

impl Hash for ContentErrorKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ContentErrorKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ContentErrorKind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.