npdatetime 0.2.4

Astronomical calculator for Bikram Sambat calendar based on solar and lunar positions. High-performance Nepali (Bikram Sambat) datetime library with multi-language bindings
Documentation
// Error types

use std::fmt;

#[derive(Debug, Clone, PartialEq)]
pub enum NpdatetimeError {
    InvalidDate(String),
    OutOfRange(String),
    ParseError(String),
    CalculationError(String),
}

impl fmt::Display for NpdatetimeError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            NpdatetimeError::InvalidDate(msg) => write!(f, "Invalid date: {}", msg),
            NpdatetimeError::OutOfRange(msg) => write!(f, "Out of range: {}", msg),
            NpdatetimeError::ParseError(msg) => write!(f, "Parse error: {}", msg),
            NpdatetimeError::CalculationError(msg) => write!(f, "Calculation error: {}", msg),
        }
    }
}

impl std::error::Error for NpdatetimeError {}

pub type Result<T> = std::result::Result<T, NpdatetimeError>;