pub enum ConversionError {
IsNotLeapYear,
TooManyDaysInMonth(u8),
IsLeapYear,
YearTooSmall,
}
Expand description
Occurs when failing to get a Hebrew Date.
Variants§
IsNotLeapYear
Occurs when attempting to get an Adar 1 or Adar 2 in a non-leap year.
§Example:
let result = HebrewDate::from_ymd(5778,HebrewMonth::Adar1,NonZeroI8::new(1).unwrap());
assert!(!result.is_ok());
assert_eq!(result.unwrap_err(),ConversionError::IsNotLeapYear);
TooManyDaysInMonth(u8)
Occurs when trying to get a Hebrew Date who’s day is out of range
§Example:
let result = HebrewDate::from_ymd(5778,HebrewMonth::Adar,NonZeroI8::new(40).unwrap());
assert!(!result.is_ok());
assert_eq!(result.unwrap_err(),ConversionError::TooManyDaysInMonth(29));
IsLeapYear
Occurs when attempting to get a regular Adar in a leap year.
§Example:
let result = HebrewDate::from_ymd(5779,HebrewMonth::Adar,NonZeroI8::new(1).unwrap());
assert!(!result.is_ok());
assert_eq!(result.unwrap_err(),ConversionError::IsLeapYear);
YearTooSmall
Occurs when attempting to get a year that is before the epoch (currently: year 3764/4).
§Example:
let result = HebrewDate::from_ymd(2448,HebrewMonth::Nissan,NonZeroI8::new(15).unwrap()); // What was the English day of the Exodus?
assert!(!result.is_ok());
assert_eq!(result.unwrap_err(),ConversionError::YearTooSmall);
Trait Implementations§
Source§impl Clone for ConversionError
impl Clone for ConversionError
Source§fn clone(&self) -> ConversionError
fn clone(&self) -> ConversionError
Returns a duplicate 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 ConversionError
impl Debug for ConversionError
Source§impl<'de> Deserialize<'de> for ConversionError
impl<'de> Deserialize<'de> for ConversionError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ConversionError
impl Display for ConversionError
Source§impl Error for ConversionError
impl Error for ConversionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for ConversionError
impl PartialEq for ConversionError
Source§impl Serialize for ConversionError
impl Serialize for ConversionError
impl Copy for ConversionError
impl Eq for ConversionError
impl StructuralPartialEq for ConversionError
Auto Trait Implementations§
impl Freeze for ConversionError
impl RefUnwindSafe for ConversionError
impl Send for ConversionError
impl Sync for ConversionError
impl Unpin for ConversionError
impl UnwindSafe for ConversionError
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