Enum icu_calendar::CalendarError
source · #[non_exhaustive]pub enum CalendarError {
Parse,
Overflow {
field: &'static str,
max: usize,
},
Underflow {
field: &'static str,
min: isize,
},
OutOfRange,
UnknownEra(TinyStr16, &'static str),
UnknownMonthCode(TinyStr4, &'static str),
MissingInput(&'static str),
UnknownAnyCalendarKind(TinyStr16),
MissingCalendar,
Data(DataError),
}
Expand description
A list of error outcomes for various operations in this module.
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.
Parse
An input could not be parsed.
Overflow
An input overflowed its range.
Underflow
An input underflowed its range.
OutOfRange
Out of range
UnknownEra(TinyStr16, &'static str)
Unknown era
UnknownMonthCode(TinyStr4, &'static str)
Unknown month code for a given calendar
MissingInput(&'static str)
Missing required input field for formatting
UnknownAnyCalendarKind(TinyStr16)
No support for a given calendar in AnyCalendar
MissingCalendar
An operation required a calendar but a calendar was not provided.
Data(DataError)
An error originating inside of the data provider.
Implementations§
source§impl CalendarError
impl CalendarError
sourcepub fn unknown_any_calendar_kind(description: impl Writeable) -> Self
pub fn unknown_any_calendar_kind(description: impl Writeable) -> Self
Create an error when an AnyCalendarKind
is expected but not available.
§Examples
use icu::calendar::AnyCalendarKind;
use icu::calendar::CalendarError;
let cal_str = "maori";
AnyCalendarKind::get_for_bcp47_string(cal_str)
.ok_or_else(|| CalendarError::unknown_any_calendar_kind(cal_str))
.expect_err("Māori calendar is not yet supported");
Trait Implementations§
source§impl Clone for CalendarError
impl Clone for CalendarError
source§fn clone(&self) -> CalendarError
fn clone(&self) -> CalendarError
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 CalendarError
impl Debug for CalendarError
source§impl Display for CalendarError
impl Display for CalendarError
source§impl From<DataError> for CalendarError
impl From<DataError> for CalendarError
source§impl From<ParseIntError> for CalendarError
impl From<ParseIntError> for CalendarError
source§fn from(_: ParseIntError) -> Self
fn from(_: ParseIntError) -> Self
Converts to this type from the input type.
source§impl PartialEq for CalendarError
impl PartialEq for CalendarError
source§fn eq(&self, other: &CalendarError) -> bool
fn eq(&self, other: &CalendarError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for CalendarError
impl StructuralPartialEq for CalendarError
Auto Trait Implementations§
impl Freeze for CalendarError
impl RefUnwindSafe for CalendarError
impl Send for CalendarError
impl Sync for CalendarError
impl Unpin for CalendarError
impl UnwindSafe for CalendarError
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