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(TinyAsciiStr<16_usize>, &'static str),
UnknownMonthCode(TinyAsciiStr<4_usize>, &'static str),
MissingInput(&'static str),
UnknownAnyCalendarKind(TinyAsciiStr<16_usize>),
MissingCalendar,
Data(DataError),
}
Expand description
A list of error outcomes for various operations in the icu_calendar
crate.
Re-exported as Error
.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
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_usize>, &'static str)
Unknown era
UnknownMonthCode(TinyAsciiStr<4_usize>, &'static str)
Unknown month code for a given calendar
MissingInput(&'static str)
Missing required input field for formatting
UnknownAnyCalendarKind(TinyAsciiStr<16_usize>)
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
sourceimpl 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
sourceimpl Clone for CalendarError
impl Clone for CalendarError
sourcefn clone(&self) -> CalendarError
fn clone(&self) -> CalendarError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CalendarError
impl Debug for CalendarError
sourceimpl Display for CalendarError
impl Display for CalendarError
sourceimpl Error for CalendarError
impl Error for CalendarError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<CalendarError> for DateTimeError
impl From<CalendarError> for DateTimeError
sourcefn from(e: CalendarError) -> DateTimeError
fn from(e: CalendarError) -> DateTimeError
Converts to this type from the input type.
sourceimpl From<DataError> for CalendarError
impl From<DataError> for CalendarError
sourcefn from(e: DataError) -> CalendarError
fn from(e: DataError) -> CalendarError
Converts to this type from the input type.
sourceimpl From<ParseIntError> for CalendarError
impl From<ParseIntError> for CalendarError
sourcefn from(ParseIntError) -> CalendarError
fn from(ParseIntError) -> CalendarError
Converts to this type from the input type.
sourceimpl PartialEq<CalendarError> for CalendarError
impl PartialEq<CalendarError> for CalendarError
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &CalendarError) -> bool
fn ne(&self, other: &CalendarError) -> bool
This method tests for !=
.
impl Copy for CalendarError
impl StructuralPartialEq for CalendarError
Auto Trait Implementations
impl RefUnwindSafe for CalendarError
impl Send for CalendarError
impl Sync for CalendarError
impl Unpin for CalendarError
impl UnwindSafe for CalendarError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Separable for T where
T: Display,
impl<T> Separable for T where
T: Display,
sourcefn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
Adds separators according to the given SeparatorPolicy
. Read more
sourcefn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Inserts a comma every three digits from the right. Read more
sourcefn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Inserts a space every three digits from the right. Read more
sourcefn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Inserts a period every three digits from the right. Read more
sourcefn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Inserts an underscore every three digits from the right. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more