pub(crate) mod invalid_format;
pub(crate) mod out_of_range;
pub use self::{invalid_format::InvalidFormat, out_of_range::OutOfRange};
use std::{error, fmt};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AstrolabeError {
OutOfRange(OutOfRange),
InvalidFormat(InvalidFormat),
}
impl fmt::Display for AstrolabeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::OutOfRange(e) => e.fmt(f),
Self::InvalidFormat(e) => e.fmt(f),
}
}
}
impl error::Error for AstrolabeError {}
impl From<AstrolabeError> for String {
fn from(e: AstrolabeError) -> Self {
e.to_string()
}
}
impl From<&AstrolabeError> for String {
fn from(e: &AstrolabeError) -> Self {
e.to_string()
}
}