Introduce the VersionExt trait

In preparation for moving the `transaction::Version` type to
`primitives`; add a `VersionExt` trait using our macro.
This commit is contained in:
Tobin C. Harding 2024-09-03 10:57:58 +10:00
parent fb89974b82
commit f490222068
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 5 additions and 5 deletions

View File

@ -946,14 +946,14 @@ impl Version {
pub const TWO: Self = Self(2);
}
mod tmp {
use super::*;
impl Version {
crate::internal_macros::define_extension_trait! {
/// Extension functionality for the [`Version`] type.
pub trait VersionExt impl for Version {
/// Creates a non-standard transaction version.
pub fn non_standard(version: i32) -> Version { Self(version) }
fn non_standard(version: i32) -> Version { Self(version) }
/// Returns true if this transaction version number is considered standard.
pub fn is_standard(&self) -> bool { *self == Version::ONE || *self == Version::TWO }
fn is_standard(&self) -> bool { *self == Version::ONE || *self == Version::TWO }
}
}