pub struct TimeZoneIdMapperWithFastCanonicalization<I> {
inner: I,
data: DataPayload<Bcp47ToIanaMapV1Marker>,
}
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.
Fields§
§inner: I
§data: DataPayload<Bcp47ToIanaMapV1Marker>
Implementations§
source§impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper>
impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper>
sourcepub fn new() -> Self
pub fn new() -> Self
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, TimeZoneError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), ) -> Result<Self, TimeZoneError>
A version of Self::new
that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_unstable<P>(provider: &P) -> Result<Self, TimeZoneError>
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, TimeZoneError>
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, TimeZoneError>
pub fn try_new_with_mapper(mapper: I) -> Result<Self, TimeZoneError>
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, TimeZoneError>
pub fn try_new_with_mapper_with_any_provider( provider: &(impl AnyProvider + ?Sized), mapper: I, ) -> Result<Self, TimeZoneError>
A version of Self::try_new_with_mapper
that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_with_mapper_unstable<P>(
provider: &P,
mapper: I,
) -> Result<Self, TimeZoneError>
pub fn try_new_with_mapper_unstable<P>( provider: &P, mapper: I, ) -> Result<Self, TimeZoneError>
A version of Self::new
that uses custom data provided by a DataProvider
.
fn validated(self) -> Result<Self, TimeZoneError>
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 more