Make Version::maybe_non_standard and Version::is_standard const

This commit is contained in:
Shing Him Ng 2025-04-21 21:53:47 -05:00
parent ddd27eddc4
commit 6370aac7e1
1 changed files with 3 additions and 3 deletions

View File

@ -564,7 +564,7 @@ impl Version {
/// ///
/// This can accept both standard and non-standard versions. /// This can accept both standard and non-standard versions.
#[inline] #[inline]
pub fn maybe_non_standard(version: u32) -> Version { Self(version) } pub const fn maybe_non_standard(version: u32) -> Version { Self(version) }
/// Returns the inner `u32` value of this `Version`. /// Returns the inner `u32` value of this `Version`.
#[inline] #[inline]
@ -577,8 +577,8 @@ impl Version {
/// As of Bitcoin Core 28.0 ([release notes](https://bitcoincore.org/en/releases/28.0/)), /// As of Bitcoin Core 28.0 ([release notes](https://bitcoincore.org/en/releases/28.0/)),
/// versions 1, 2, and 3 are considered standard. /// versions 1, 2, and 3 are considered standard.
#[inline] #[inline]
pub fn is_standard(self) -> bool { pub const fn is_standard(self) -> bool {
self == Version::ONE || self == Version::TWO || self == Version::THREE self.0 == Version::ONE.0 || self.0 == Version::TWO.0 || self.0 == Version::THREE.0
} }
} }