1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use core::fmt::{self, Display, Formatter};

#[cfg(feature = "std")]
use std::error::Error;

use crate::semver;

#[derive(Debug, Clone)]
pub struct SemVerError(pub semver::SemVerError);

impl From<semver::SemVerError> for SemVerError {
    #[inline]
    fn from(error: semver::SemVerError) -> Self {
        SemVerError(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 {}