pub struct IanaParserExtended<I> { /* private fields */ }
Expand description
A parser that supplements IanaParser
with about 8 KB of additional data to
improve the performance of canonical IANA ID lookup.
The data in IanaParser
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 IanaParserExtended<IanaParser>
impl IanaParserExtended<IanaParser>
Sourcepub fn new() -> IanaParserExtendedBorrowed<'static>
pub fn new() -> IanaParserExtendedBorrowed<'static>
Creates a new IanaParserExtended
using compiled data.
See IanaParserExtended
for an example.
✨ Enabled with the compiled_data
Cargo feature.
Sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<IanaParserExtended<IanaParser>, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<IanaParserExtended<IanaParser>, 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<IanaParserExtended<IanaParser>, DataError>
pub fn try_new_unstable<P>( provider: &P, ) -> Result<IanaParserExtended<IanaParser>, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
Source§impl<I> IanaParserExtended<I>where
I: AsRef<IanaParser>,
impl<I> IanaParserExtended<I>where
I: AsRef<IanaParser>,
Sourcepub fn try_new_with_parser(
parser: I,
) -> Result<IanaParserExtended<I>, DataError>
pub fn try_new_with_parser( parser: I, ) -> Result<IanaParserExtended<I>, DataError>
Creates a new IanaParserExtended
using compiled data
and a pre-existing IanaParser
, which can be borrowed.
See IanaParserExtended
for an example.
✨ Enabled with the compiled_data
Cargo feature.
Sourcepub fn try_new_with_parser_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
parser: I,
) -> Result<IanaParserExtended<I>, DataError>
pub fn try_new_with_parser_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), parser: I, ) -> Result<IanaParserExtended<I>, DataError>
A version of [Self :: try_new_with_parser
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
Sourcepub fn try_new_with_parser_unstable<P>(
provider: &P,
parser: I,
) -> Result<IanaParserExtended<I>, DataError>
pub fn try_new_with_parser_unstable<P>( provider: &P, parser: I, ) -> Result<IanaParserExtended<I>, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
Sourcepub fn as_borrowed(&self) -> IanaParserExtendedBorrowed<'_>
pub fn as_borrowed(&self) -> IanaParserExtendedBorrowed<'_>
Returns a borrowed version of the parser that can be queried.
This avoids a small potential indirection cost when querying the parser.
Trait Implementations§
Source§impl<I> Clone for IanaParserExtended<I>where
I: Clone,
impl<I> Clone for IanaParserExtended<I>where
I: Clone,
Source§fn clone(&self) -> IanaParserExtended<I>
fn clone(&self) -> IanaParserExtended<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 IanaParserExtended<I>where
I: Freeze,
impl<I> RefUnwindSafe for IanaParserExtended<I>where
I: RefUnwindSafe,
impl<I> Send for IanaParserExtended<I>where
I: Send,
impl<I> Sync for IanaParserExtended<I>where
I: Sync,
impl<I> Unpin for IanaParserExtended<I>where
I: Unpin,
impl<I> UnwindSafe for IanaParserExtended<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§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