#[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
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: 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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)