Introduce OutPoint extension traits
In preparation for moving the `OutPoint` over to `primitives` add an extension trait to hold everything that will stay behind.
This commit is contained in:
parent
7e5bd5048d
commit
f5c46cd411
|
@ -404,6 +404,7 @@ mod test {
|
|||
use crate::consensus::encode::{deserialize, serialize};
|
||||
use crate::locktime::absolute;
|
||||
use crate::merkle_tree::TxMerkleNode;
|
||||
use crate::transaction::OutPointExt;
|
||||
use crate::{
|
||||
transaction, Amount, CompactTarget, OutPoint, ScriptBuf, Sequence, TxIn, TxOut, Txid,
|
||||
Witness,
|
||||
|
|
|
@ -99,21 +99,20 @@ impl OutPoint {
|
|||
pub const COINBASE_PREVOUT: Self = Self { txid: Txid::COINBASE_PREVOUT, vout: u32::MAX };
|
||||
}
|
||||
|
||||
impl OutPoint {
|
||||
crate::internal_macros::define_extension_trait! {
|
||||
/// Extension functionality for the [`OutPoint`] type.
|
||||
pub trait OutPointExt impl for OutPoint {
|
||||
/// Creates a new [`OutPoint`].
|
||||
#[inline]
|
||||
#[deprecated(since = "TBD", note = "use struct initialization syntax instead")]
|
||||
pub const fn new(txid: Txid, vout: u32) -> OutPoint { OutPoint { txid, vout } }
|
||||
|
||||
/// Creates a "null" `OutPoint`.
|
||||
#[inline]
|
||||
#[deprecated(since = "TBD", note = "use OutPoint::COINBASE_PREVOUT instead")]
|
||||
pub fn null() -> OutPoint { Self::COINBASE_PREVOUT }
|
||||
#[allow(clippy::new-ret-no-self)]
|
||||
fn new(txid: Txid, vout: u32) -> Self { OutPoint { txid, vout } }
|
||||
|
||||
/// Checks if an `OutPoint` is "null".
|
||||
#[inline]
|
||||
#[deprecated(since = "TBD", note = "use outpoint == OutPoint::COINBASE_PREVOUT instead")]
|
||||
pub fn is_null(&self) -> bool { *self == OutPoint::null() }
|
||||
fn is_null(&self) -> bool { *self == OutPoint::COINBASE_PREVOUT }
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for OutPoint {
|
||||
|
|
Loading…
Reference in New Issue