Enum icu_locid::ParserError
source · #[non_exhaustive]pub enum ParserError {
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 copy of the value. Read more
1.0.0 · 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
This method 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 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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)