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)
.
pub fn get_appropriate_language_region(
&self,
locales: &[LanguageIdentifier]
) -> Option<(Language, Option<Region>)>
pub fn get_appropriate_language_region(
&self,
locales: &[LanguageIdentifier]
) -> Option<(Language, Option<Region>)>
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
Auto Trait Implementations
impl RefUnwindSafe for AcceptLanguage
impl Send for AcceptLanguage
impl Sync for AcceptLanguage
impl Unpin for AcceptLanguage
impl UnwindSafe for AcceptLanguage
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.