pub struct IntlContext { /* private fields */ }Expand description
Shared locale data and message cache for request-scoped Intl instances.
Implementations§
Source§impl IntlContext
impl IntlContext
Sourcepub fn try_with_provider(
provider: impl BufferProvider + Send + Sync + 'static,
) -> Result<Self, DataError>
pub fn try_with_provider( provider: impl BufferProvider + Send + Sync + 'static, ) -> Result<Self, DataError>
Uses one provider for all formatters and locale negotiation.
Sourcepub fn check_catalog(&self, catalog: &MessageCatalog) -> Result<()>
pub fn check_catalog(&self, catalog: &MessageCatalog) -> Result<()>
Checks every formatter for each catalog locale without root fallback for language data.
Regional fallback, region defaults, global data, and explicit und remain valid.
Generate blobs with --deduplication none or retain-base-languages;
maximal removes root-identical locale data that this check requires.
Sourcepub fn negotiate_locale<I, S>(
&self,
requested_locales: I,
default_locale: &Locale,
catalog: &MessageCatalog,
) -> Result<Locale>
pub fn negotiate_locale<I, S>( &self, requested_locales: I, default_locale: &Locale, catalog: &MessageCatalog, ) -> Result<Locale>
Picks the catalog locale for requested_locales with this context’s fallback data;
the free function negotiate_locale does the same with compiled data.
Trait Implementations§
Source§impl Clone for IntlContext
impl Clone for IntlContext
impl RefUnwindSafe for IntlContext
impl UnwindSafe for IntlContext
Auto Trait Implementations§
impl Freeze for IntlContext
impl Send for IntlContext
impl Sync for IntlContext
impl Unpin for IntlContext
impl UnsafeUnpin for IntlContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more