1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use core::fmt::{self, Display, Formatter};
#[cfg(feature = "std")]
use std::error::Error;

/// Error from the `semver` and `semver_req` validator.
#[derive(Debug)]
pub struct SemverError(pub semver::Error);

impl From<semver::Error> for SemverError {
    #[inline]
    fn from(error: semver::Error) -> Self {
        Self(error)
    }
}

impl Display for SemverError {
    #[inline]
    fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
        Display::fmt(&self.0, f)
    }
}

#[cfg(feature = "std")]
impl Error for SemverError {}