pub struct TimeZoneIdMapperWithFastCanonicalization<I> { /* private fields */ }
Expand description
A mapper that supplements TimeZoneIdMapper
with about 8 KB of additional data to
improve the performance of canonical IANA ID lookup.
The data in TimeZoneIdMapper
is optimized for IANA to BCP-47 lookup; the reverse
requires a linear walk over all ~600 IANA identifiers. The data added here allows for
constant-time mapping from BCP-47 to IANA.
Implementations§
source§impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper>
impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper>
sourcepub fn new() -> TimeZoneIdMapperWithFastCanonicalizationBorrowed<'static>
pub fn new() -> TimeZoneIdMapperWithFastCanonicalizationBorrowed<'static>
Creates a new TimeZoneIdMapperWithFastCanonicalization
using compiled data.
See TimeZoneIdMapperWithFastCanonicalization
for an example.
✨ Enabled with the compiled_data
Cargo feature.
sourcepub fn try_new_with_any_provider(
provider: &(impl AnyProvider + ?Sized),
) -> Result<Self, DataError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), ) -> Result<Self, DataError>
A version of [Self :: new
] that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<Self, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<Self, DataError>
A version of [Self :: new
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
sourcepub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
source§impl<I> TimeZoneIdMapperWithFastCanonicalization<I>where
I: AsRef<TimeZoneIdMapper>,
impl<I> TimeZoneIdMapperWithFastCanonicalization<I>where
I: AsRef<TimeZoneIdMapper>,
sourcepub fn try_new_with_mapper(mapper: I) -> Result<Self, DataError>
pub fn try_new_with_mapper(mapper: I) -> Result<Self, DataError>
Creates a new TimeZoneIdMapperWithFastCanonicalization
using compiled data
and a pre-existing TimeZoneIdMapper
, which can be borrowed.
See TimeZoneIdMapperWithFastCanonicalization
for an example.
✨ Enabled with the compiled_data
Cargo feature.
sourcepub fn try_new_with_mapper_with_any_provider(
provider: &(impl AnyProvider + ?Sized),
mapper: I,
) -> Result<Self, DataError>
pub fn try_new_with_mapper_with_any_provider( provider: &(impl AnyProvider + ?Sized), mapper: I, ) -> Result<Self, DataError>
A version of [Self :: try_new_with_mapper
] that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_with_mapper_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
mapper: I,
) -> Result<Self, DataError>
pub fn try_new_with_mapper_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), mapper: I, ) -> Result<Self, DataError>
A version of [Self :: try_new_with_mapper
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
sourcepub fn try_new_with_mapper_unstable<P>(
provider: &P,
mapper: I,
) -> Result<Self, DataError>
pub fn try_new_with_mapper_unstable<P>( provider: &P, mapper: I, ) -> Result<Self, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
sourcepub fn inner(&self) -> &TimeZoneIdMapper
pub fn inner(&self) -> &TimeZoneIdMapper
Gets the inner TimeZoneIdMapper
for performing queries.
sourcepub fn as_borrowed(
&self,
) -> TimeZoneIdMapperWithFastCanonicalizationBorrowed<'_>
pub fn as_borrowed( &self, ) -> TimeZoneIdMapperWithFastCanonicalizationBorrowed<'_>
Returns a borrowed version of the mapper that can be queried.
This avoids a small potential indirection cost when querying the mapper.
Trait Implementations§
source§impl<I: Clone> Clone for TimeZoneIdMapperWithFastCanonicalization<I>
impl<I: Clone> Clone for TimeZoneIdMapperWithFastCanonicalization<I>
source§fn clone(&self) -> TimeZoneIdMapperWithFastCanonicalization<I>
fn clone(&self) -> TimeZoneIdMapperWithFastCanonicalization<I>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<I> Freeze for TimeZoneIdMapperWithFastCanonicalization<I>where
I: Freeze,
impl<I> RefUnwindSafe for TimeZoneIdMapperWithFastCanonicalization<I>where
I: RefUnwindSafe,
impl<I> Send for TimeZoneIdMapperWithFastCanonicalization<I>where
I: Send,
impl<I> Sync for TimeZoneIdMapperWithFastCanonicalization<I>where
I: Sync,
impl<I> Unpin for TimeZoneIdMapperWithFastCanonicalization<I>where
I: Unpin,
impl<I> UnwindSafe for TimeZoneIdMapperWithFastCanonicalization<I>where
I: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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