2024-04-21 19:56:00 +00:00
|
|
|
use std::fmt::{self, Display};
|
|
|
|
|
2024-04-28 22:53:45 +00:00
|
|
|
use rustc_macros::{Decodable, Encodable, HashStable_Generic, current_rustc_version};
|
2023-10-27 00:18:21 +00:00
|
|
|
|
|
|
|
#[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 06:05:44 +00:00
|
|
|
pub const CURRENT: Self = current_rustc_version!();
|
2023-10-27 00:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Display for RustcVersion {
|
|
|
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
|
|
|
|
}
|
|
|
|
}
|