Struct rocket_accept_language::AcceptLanguage
source · [−]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
sourceimpl AcceptLanguage
impl AcceptLanguage
sourcepub fn get_first_region(&self) -> Option<Region>
pub fn get_first_region(&self) -> Option<Region>
Get the first region. For example, a region can be "US"
, "TW"
or "GB"
.
sourcepub fn get_first_language(&self) -> Option<Language>
pub fn get_first_language(&self) -> Option<Language>
Get the first language. For example, a language can be "en"
, "zh"
or "jp"
.
sourcepub fn get_first_language_region(&self) -> Option<(Language, Option<Region>)>
pub fn get_first_language_region(&self) -> Option<(Language, Option<Region>)>
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)
.
sourcepub 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
sourceimpl Clone for AcceptLanguage
impl Clone for AcceptLanguage
sourcefn clone(&self) -> AcceptLanguage
fn clone(&self) -> AcceptLanguage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AcceptLanguage
impl Debug for AcceptLanguage
sourceimpl<'r> FromRequest<'r> for AcceptLanguage
impl<'r> FromRequest<'r> for AcceptLanguage
sourceimpl<'r> FromRequest<'r> for &'r AcceptLanguage
impl<'r> FromRequest<'r> for &'r AcceptLanguage
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more