Struct rocket_accept_language::AcceptLanguage[][src]

pub struct AcceptLanguage {
    pub accept_language: Vec<LanguageIdentifier>,
}
Expand description

The request guard used for getting accept-language header.

Fields

accept_language: Vec<LanguageIdentifier>

Implementations

Get the first region. For example, a region can be "US", "TW" or "GB".

Get the first language. For example, a language can be "en", "zh" or "jp".

Get the first language-region pair. The region might not exist. For example, a language-region pair can be ("en", Some("US")), ("en", Some("GB")), ("zh", Some("TW")) or ("zh", None).

Get the appropriate language-region pair. If the region can not be matched, and there is no matched language-region pairs, returns the first matched language.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The associated error to be returned if derivation fails.

Derives an instance of Self from the incoming request metadata. Read more

The associated error to be returned if derivation fails.

Derives an instance of Self from the incoming request metadata. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

Converts self into a collection.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.