2024-04-29 08:53:45 +10:00
|
|
|
use rustc_macros::{current_rustc_version, Decodable, Encodable, HashStable_Generic};
|
2023-10-26 17:18:21 -07:00
|
|
|
use std::fmt::{self, Display};
|
|
|
|
|
|
|
|
|
|
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
|
#[derive(HashStable_Generic)]
|
|
|
|
|
pub struct RustcVersion {
|
|
|
|
|
pub major: u16,
|
|
|
|
|
pub minor: u16,
|
|
|
|
|
pub patch: u16,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RustcVersion {
|
2023-11-08 17:05:44 +11:00
|
|
|
pub const CURRENT: Self = current_rustc_version!();
|
2023-10-26 17:18:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Display for RustcVersion {
|
|
|
|
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
|
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
|
|
|
|
|
}
|
|
|
|
|
}
|