HttpHeaderName

Enum HttpHeaderName 

Source
pub enum HttpHeaderName {
Show 45 variants Accept, AcceptCharset, AcceptEncoding, AcceptLanguage, AccessControlRequestMethod, AccessControlRequestHeaders, Authorization, CacheControl, Connection, ContentEncoding, ContentLength, ContentType, Cookie, Date, Expect, Forwarded, From, Host, Origin, Pragma, Referer, Upgrade, UserAgent, Via, Warning, AccessControlAllowOrigin, AccessControlAllowHeaders, AccessControlAllowMethods, Age, Allow, ContentDisposition, ContentLanguage, ContentLocation, ETag, Expires, LastModified, Link, Location, Server, SetCookie, TransferEncoding, TE, Trailer, ProxyAuthenticate, Custom(String),
}
Expand description

Represents a header received in a request. TODO implement to &str fn to prevent clone on serialization!

Variants§

§

Accept

Informs the server about the types of data that can be sent back.

§

AcceptCharset

Informs the server about the accepted character encodings.

§

AcceptEncoding

Indicates the content encoding(s) understood by the client, usually compression algorithms.

§

AcceptLanguage

Informs the server about the client’s language(s).

§

AccessControlRequestMethod

Indicates the method that will be used for the actual request when performing an OPTIONS request.

§

AccessControlRequestHeaders

Indicates the headers that will be used for the actual request when performing an OPTIONS request.

§

Authorization

Provides credentials for HTTP authentication.

§

CacheControl

Indicates how the cache should behave.

§

Connection

Indicates what should happen to the connection after the request is served.

§

ContentEncoding

Lists any encodings used on the payload.

§

ContentLength

Indicates the length of the payload body.

§

ContentType

Indicates the MIME type of the payload body.

§

Cookie

Shares any applicable HTTP cookies with the server.

§

Date

Indicates the date and time at which the request was sent.

§

Expect

Indicates any expectations that must be met by the server in order to properly serve the request.

§

Forwarded

May contain reverse proxy information, generally not used in favour of the X-Forwarded-For header.

§

From

Indicates the email address of the client, often used by crawlers.

§

Host

Specifies the host to which the request is being sent, e.g. “www.example.com”.

§

Origin

Indicates the origin that caused the request.

§

Pragma

Contains backwards-compatible caching information.

§

Referer

Indicates the absolute or partial address of the page making the request.

§

Upgrade

Indicates that the connection is to be upgraded to a different protocol, e.g. WebSocket.

§

UserAgent

Informs the server of basic browser and device information.

§

Via

Contains the addresses of proxies through which the request has been forwarded.

§

Warning

Contains information about possible problems with the request.

§

AccessControlAllowOrigin

Indicates whether the response can be shared with other origins.

§

AccessControlAllowHeaders

Indicates whether certain headers can be set.

§

AccessControlAllowMethods

Indicates whether certain methods can be used.

§

Age

Contains the time in seconds that the object has been cached.

§

Allow

The set of methods supported by the resource.

§

ContentDisposition

Indicates whether the response is to be displayed as a webpage or downloaded directly.

§

ContentLanguage

Informs the client of the language of the payload body.

§

ContentLocation

Indicates an alternative location for the returned data.

§

ETag

Identifies a specific version of a resource.

§

Expires

Contains the date and time at which the response is considered expired.

§

LastModified

Indicates the date and time at which the response was last modified.

Provides a means for serialising links in the headers, equivalent to the HTML <link> element.

§

Location

Indicates the location at which the resource can be found, used for redirects.

§

Server

Contains information about the server which served the request.

§

SetCookie

Indicates that the client should set the specified cookies.

§

TransferEncoding

Indicates the encoding used in the transfer of the payload body.

§

TE

§

Trailer

Trailer encoding

§

ProxyAuthenticate

Indicates that a proxy server in the connection needs authentication.

§

Custom(String)

Custom header with a lowercase name

Implementations§

Source§

impl HttpHeaderName

Source

pub fn well_known() -> &'static [HttpHeaderName]

Returns a static array of all well known header types

Source

pub fn is_custom(&self) -> bool

Returns true if the header is not well known and the name is heap allocated.

Source

pub fn is_well_known(&self) -> bool

Returns true if the header is well known and not heap allocated.

Source

pub fn to_str(&self) -> &str

Returns a &str of the header value without copying. This has the same lifetime as self because the header string may be a custom header that is heap allocated.

Source

pub fn well_known_str(&self) -> Option<&'static str>

Return Some with a static lifetime if self is not a heap allocated custom header. If self is a custom header that is heap allocated (and therefore has a non-static lifetime) It will return none

Trait Implementations§

Source§

impl AsRef<str> for HttpHeaderName

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for HttpHeaderName

Source§

fn clone(&self) -> HttpHeaderName

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpHeaderName

Source§

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

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

impl Display for HttpHeaderName

Source§

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

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

impl From<&str> for HttpHeaderName

Source§

fn from(name: &str) -> Self

Converts to this type from the input type.
Source§

impl Hash for HttpHeaderName

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 Ord for HttpHeaderName

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for HttpHeaderName

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for HttpHeaderName

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for HttpHeaderName

Source§

impl StructuralPartialEq for HttpHeaderName

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> Same for T

Source§

type Output = T

Should always be Self
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> 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, 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.