Enum icu_datetime::input::CalendarError
source · #[non_exhaustive]pub(crate) enum CalendarError {
Parse,
Overflow {
field: &'static str,
max: usize,
},
Underflow {
field: &'static str,
min: isize,
},
OutOfRange,
UnknownEra(TinyAsciiStr<16>, &'static str),
UnknownMonthCode(TinyAsciiStr<4>, &'static str),
MissingInput(&'static str),
UnknownAnyCalendarKind(TinyAsciiStr<16>),
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(TinyAsciiStr<16>, &'static str)
Unknown era
UnknownMonthCode(TinyAsciiStr<4>, &'static str)
Unknown month code for a given calendar
MissingInput(&'static str)
Missing required input field for formatting
UnknownAnyCalendarKind(TinyAsciiStr<16>)
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) -> CalendarError
pub fn unknown_any_calendar_kind(description: impl Writeable) -> CalendarError
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<CalendarError> for DateTimeError
impl From<CalendarError> for DateTimeError
source§fn from(e: CalendarError) -> Self
fn from(e: CalendarError) -> Self
Converts to this type from the input type.
source§impl From<DataError> for CalendarError
impl From<DataError> for CalendarError
source§fn from(e: DataError) -> CalendarError
fn from(e: DataError) -> CalendarError
Converts to this type from the input type.
source§impl From<ParseIntError> for CalendarError
impl From<ParseIntError> for CalendarError
source§fn from(_: ParseIntError) -> CalendarError
fn from(_: ParseIntError) -> CalendarError
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
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