Deprecate min/max_value methods
Our previous MSRV did not support MIN/MAX associated consts so we had methods min/max_value. Now that our MSRV is Rust 1.48.0 we can use the consts. Deprecate min/max_value methods in favor of MIN/MAX associated conts.
This commit is contained in:
parent
5fbbd483ea
commit
6cab7beba3
|
@ -506,9 +506,11 @@ impl Amount {
|
||||||
pub fn to_sat(self) -> u64 { self.0 }
|
pub fn to_sat(self) -> u64 { self.0 }
|
||||||
|
|
||||||
/// The maximum value of an [Amount].
|
/// The maximum value of an [Amount].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Amount { Amount(u64::max_value()) }
|
pub const fn max_value() -> Amount { Amount(u64::max_value()) }
|
||||||
|
|
||||||
/// The minimum value of an [Amount].
|
/// The minimum value of an [Amount].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> Amount { Amount(u64::min_value()) }
|
pub const fn min_value() -> Amount { Amount(u64::min_value()) }
|
||||||
|
|
||||||
/// Convert from a value expressing bitcoins to an [Amount].
|
/// Convert from a value expressing bitcoins to an [Amount].
|
||||||
|
@ -845,9 +847,11 @@ impl SignedAmount {
|
||||||
pub fn to_sat(self) -> i64 { self.0 }
|
pub fn to_sat(self) -> i64 { self.0 }
|
||||||
|
|
||||||
/// The maximum value of an [SignedAmount].
|
/// The maximum value of an [SignedAmount].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> SignedAmount { SignedAmount(i64::max_value()) }
|
pub const fn max_value() -> SignedAmount { SignedAmount(i64::max_value()) }
|
||||||
|
|
||||||
/// The minimum value of an [SignedAmount].
|
/// The minimum value of an [SignedAmount].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> SignedAmount { SignedAmount(i64::min_value()) }
|
pub const fn min_value() -> SignedAmount { SignedAmount(i64::min_value()) }
|
||||||
|
|
||||||
/// Convert from a value expressing bitcoins to an [SignedAmount].
|
/// Convert from a value expressing bitcoins to an [SignedAmount].
|
||||||
|
|
|
@ -397,11 +397,13 @@ impl Height {
|
||||||
/// The minimum absolute block height (0), the genesis block.
|
/// The minimum absolute block height (0), the genesis block.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MIN`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MIN`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> Self { Self::MIN }
|
pub const fn min_value() -> Self { Self::MIN }
|
||||||
|
|
||||||
/// The maximum absolute block height.
|
/// The maximum absolute block height.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Self::MAX }
|
pub const fn max_value() -> Self { Self::MAX }
|
||||||
|
|
||||||
/// Constructs a new block height.
|
/// Constructs a new block height.
|
||||||
|
@ -477,11 +479,13 @@ impl Time {
|
||||||
/// The minimum absolute block time.
|
/// The minimum absolute block time.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MIN`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MIN`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> Self { Self::MIN }
|
pub const fn min_value() -> Self { Self::MIN }
|
||||||
|
|
||||||
/// The maximum absolute block time.
|
/// The maximum absolute block time.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Self::MAX }
|
pub const fn max_value() -> Self { Self::MAX }
|
||||||
|
|
||||||
/// Constructs a new block time.
|
/// Constructs a new block time.
|
||||||
|
|
|
@ -210,11 +210,13 @@ impl Height {
|
||||||
/// The minimum relative block height (0), can be included in any block.
|
/// The minimum relative block height (0), can be included in any block.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MIN`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MIN`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> Self { Self::MIN }
|
pub const fn min_value() -> Self { Self::MIN }
|
||||||
|
|
||||||
/// The maximum relative block height.
|
/// The maximum relative block height.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Height::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Self::MAX }
|
pub const fn max_value() -> Self { Self::MAX }
|
||||||
|
|
||||||
/// Returns the inner `u16` value.
|
/// Returns the inner `u16` value.
|
||||||
|
@ -254,11 +256,13 @@ impl Time {
|
||||||
/// The minimum relative block time.
|
/// The minimum relative block time.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MIN`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MIN`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MIN instead")]
|
||||||
pub const fn min_value() -> Self { Self::MIN }
|
pub const fn min_value() -> Self { Self::MIN }
|
||||||
|
|
||||||
/// The maximum relative block time.
|
/// The maximum relative block time.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Time::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Self::MAX }
|
pub const fn max_value() -> Self { Self::MAX }
|
||||||
|
|
||||||
/// Create a [`Time`] using time intervals where each interval is equivalent to 512 seconds.
|
/// Create a [`Time`] using time intervals where each interval is equivalent to 512 seconds.
|
||||||
|
|
|
@ -305,6 +305,7 @@ impl Sequence {
|
||||||
/// The maximum allowable sequence number.
|
/// The maximum allowable sequence number.
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Sequence::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Sequence::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Self::MAX }
|
pub const fn max_value() -> Self { Self::MAX }
|
||||||
|
|
||||||
/// Returns `true` if the sequence number enables absolute lock-time ([`Transaction::lock_time`]).
|
/// Returns `true` if the sequence number enables absolute lock-time ([`Transaction::lock_time`]).
|
||||||
|
|
|
@ -133,6 +133,7 @@ impl Target {
|
||||||
/// The maximum possible target (see [`Target::MAX`]).
|
/// The maximum possible target (see [`Target::MAX`]).
|
||||||
///
|
///
|
||||||
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Target::MAX`].
|
/// This is provided for consistency with Rust 1.41.1, newer code should use [`Target::MAX`].
|
||||||
|
#[deprecated(since = "0.31.0", note = "Use Self::MAX instead")]
|
||||||
pub const fn max_value() -> Self { Target::MAX }
|
pub const fn max_value() -> Self { Target::MAX }
|
||||||
|
|
||||||
/// Computes the [`Target`] value from a compact representation.
|
/// Computes the [`Target`] value from a compact representation.
|
||||||
|
|
Loading…
Reference in New Issue