#[non_exhaustive]pub enum Error {
InvalidLanguage,
InvalidSubtag,
InvalidExtension,
DuplicatedExtension,
}Expand description
List of parser errors that can be generated
while parsing LanguageIdentifier, Locale,
subtags or extensions.
Re-exported as Error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InvalidLanguage
Invalid language subtag.
§Examples
use icu::locid::subtags::Language;
use icu::locid::ParserError;
assert_eq!("x2".parse::<Language>(), Err(ParserError::InvalidLanguage));InvalidSubtag
Invalid script, region or variant subtag.
§Examples
use icu::locid::subtags::Region;
use icu::locid::ParserError;
assert_eq!("#@2X".parse::<Region>(), Err(ParserError::InvalidSubtag));InvalidExtension
Invalid extension subtag.
§Examples
use icu::locid::extensions::unicode::Key;
use icu::locid::ParserError;
assert_eq!("#@2X".parse::<Key>(), Err(ParserError::InvalidExtension));DuplicatedExtension
Duplicated extension.
§Examples
use icu::locid::Locale;
use icu::locid::ParserError;
assert_eq!(
"und-u-hc-h12-u-ca-calendar".parse::<Locale>(),
Err(ParserError::DuplicatedExtension)
);Trait Implementations§
Source§impl Clone for ParserError
impl Clone for ParserError
Source§fn clone(&self) -> ParserError
fn clone(&self) -> ParserError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParserError
impl Debug for ParserError
Source§impl Display for ParserError
impl Display for ParserError
Source§impl PartialEq for ParserError
impl PartialEq for ParserError
Source§fn eq(&self, other: &ParserError) -> bool
fn eq(&self, other: &ParserError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ParserError
impl StructuralPartialEq for ParserError
Auto Trait Implementations§
impl Freeze for ParserError
impl RefUnwindSafe for ParserError
impl Send for ParserError
impl Sync for ParserError
impl Unpin for ParserError
impl UnsafeUnpin for ParserError
impl UnwindSafe for ParserError
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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