absolute: make is_* methods uniform with the ones from relative
This commit is contained in:
parent
878b865f85
commit
04715e3e60
|
@ -7,7 +7,7 @@
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
use core::{fmt, mem};
|
use core::fmt;
|
||||||
|
|
||||||
use io::{BufRead, Write};
|
use io::{BufRead, Write};
|
||||||
#[cfg(all(test, mutate))]
|
#[cfg(all(test, mutate))]
|
||||||
|
@ -170,18 +170,17 @@ impl LockTime {
|
||||||
|
|
||||||
/// Returns true if both lock times use the same unit i.e., both height based or both time based.
|
/// Returns true if both lock times use the same unit i.e., both height based or both time based.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_same_unit(&self, other: LockTime) -> bool {
|
pub const fn is_same_unit(&self, other: LockTime) -> bool {
|
||||||
mem::discriminant(self) == mem::discriminant(&other)
|
matches!(
|
||||||
|
(self, other),
|
||||||
|
(LockTime::Blocks(_), LockTime::Blocks(_))
|
||||||
|
| (LockTime::Seconds(_), LockTime::Seconds(_))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this lock time value is a block height.
|
/// Returns true if this lock time value is a block height.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_block_height(&self) -> bool {
|
pub const fn is_block_height(&self) -> bool { matches!(*self, LockTime::Blocks(_)) }
|
||||||
match *self {
|
|
||||||
LockTime::Blocks(_) => true,
|
|
||||||
LockTime::Seconds(_) => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if this lock time value is a block time (UNIX timestamp).
|
/// Returns true if this lock time value is a block time (UNIX timestamp).
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in New Issue