astrolabe 0.5.4

Date and time library for Rust. Aims to be feature rich, lightweight and easy-to-use.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::AstrolabeError;
use std::fmt;

/// An error indicating that the string to be parsed is invalid.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct InvalidFormat(String);

impl fmt::Display for InvalidFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.0)
    }
}

pub(crate) fn create_invalid_format(message: String) -> AstrolabeError {
    AstrolabeError::InvalidFormat(InvalidFormat(message))
}