findates 0.1.2

Financial date arithmetic: business day calendars, day count conventions, and schedule generation.
Documentation
//! Error types returned by fallible findates functions.
//!
//! Currently contains [`DayCountError`], returned by
//! [`algebra::day_count_fraction`](crate::algebra::day_count_fraction)
//! when called with an incompatible combination of arguments.

use std::fmt;

/// Errors returned by day count fraction calculations.
#[derive(Debug, PartialEq, Eq)]
pub enum DayCountError {
    /// Returned when [`DayCount::Bd252`](crate::conventions::DayCount::Bd252) is
    /// called without a calendar.
    MissingCalendar,
}

impl fmt::Display for DayCountError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DayCountError::MissingCalendar => {
                write!(f, "DayCount::Bd252 requires a Calendar")
            }
        }
    }
}

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