pub struct Outpoint<M> where
M: MarkedDigestOutput, {
pub txid: M,
pub idx: u32,
}
Expand description
An Outpoint. This is a unique identifier for a UTXO, and is composed of a transaction ID (in Bitcoin-style LE format), and the index of the output being spent within that transactions output vectour (vout).
Outpoint::null()
and Outpoint::default()
return the null Outpoint, which references a txid
of all 0, and a index 0xffff_ffff. This null outpoint is used in every coinbase transaction.
Fields
txid: M
The txid that created the UTXO being pointed to.
idx: u32
The index of that UTXO in the transaction’s output vector.
Implementations
sourceimpl<M> Outpoint<M> where
M: MarkedDigestOutput,
impl<M> Outpoint<M> where
M: MarkedDigestOutput,
sourcepub fn null() -> Self
pub fn null() -> Self
Returns the default
, or null
Outpoint. This is used in the coinbase input.
sourcepub fn txid_be_hex(&self) -> String
pub fn txid_be_hex(&self) -> String
Return the BE txid as hex, suitable for block explorers
sourcepub fn from_explorer_format(txid_be: M, idx: u32) -> Self
pub fn from_explorer_format(txid_be: M, idx: u32) -> Self
Instantiate an outpoint from the Block Explorer (big-endian) TXID format and integer index
Trait Implementations
sourceimpl<M> ByteFormat for Outpoint<M> where
M: MarkedDigestOutput + ByteFormat,
impl<M> ByteFormat for Outpoint<M> where
M: MarkedDigestOutput + ByteFormat,
sourcefn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the byte-length of the serialized data structure.
sourcefn read_from<T>(reader: &mut T) -> SerResult<Self> where
T: Read,
Self: Sized,
fn read_from<T>(reader: &mut T) -> SerResult<Self> where
T: Read,
Self: Sized,
Deserializes an instance of Self
from a std::io::Read
.
The limit
argument is used only when deserializing collections, and specifies a maximum
number of instances of the underlying type to read. Read more
sourcefn write_to<T>(&self, writer: &mut T) -> SerResult<usize> where
T: Write,
fn write_to<T>(&self, writer: &mut T) -> SerResult<usize> where
T: Write,
Serializes self
to a std::io::Write
. Following Write
trait conventions, its Ok
type must be a usize
denoting the number of bytes written. Read more
sourcefn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
fn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
Read a sequence of exactly limit
objects from the reader.
sourcefn write_seq_to<'a, W, E, Iter, Item>(
writer: &mut W,
iter: Iter
) -> Result<usize, Self::Error> where
W: Write,
E: Into<Self::Error> + From<SerError> + From<Error> + Error,
Item: 'a + ByteFormat<Error = E>,
Iter: IntoIterator<Item = &'a Item>,
fn write_seq_to<'a, W, E, Iter, Item>(
writer: &mut W,
iter: Iter
) -> Result<usize, Self::Error> where
W: Write,
E: Into<Self::Error> + From<SerError> + From<Error> + Error,
Item: 'a + ByteFormat<Error = E>,
Iter: IntoIterator<Item = &'a Item>,
Write a sequence of ByteFormat
objects to a writer. The iter
argument may be any object that implements
IntoIterator<Item = &Item>
. This means we can seamlessly use vectors,
slices, etc. Read more
sourcefn deserialize_hex(s: &str) -> Result<Self, Self::Error>
fn deserialize_hex(s: &str) -> Result<Self, Self::Error>
Decodes a hex string to a Vec<u8>
, deserializes an instance of Self
from that vector.
sourcefn deserialize_base64(s: &str) -> Result<Self, Self::Error>
fn deserialize_base64(s: &str) -> Result<Self, Self::Error>
Serialize self
to a base64 string, using standard RFC4648 non-url safe characters
sourcefn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Serializes self
to a vector, returns the hex-encoded vector
sourcefn serialize_base64(&self) -> String
fn serialize_base64(&self) -> String
Serialize self
to a base64 string, using standard RFC4648 non-url safe characters
sourceimpl<M: Clone> Clone for Outpoint<M> where
M: MarkedDigestOutput,
impl<M: Clone> Clone for Outpoint<M> where
M: MarkedDigestOutput,
sourceimpl<M: Debug> Debug for Outpoint<M> where
M: MarkedDigestOutput,
impl<M: Debug> Debug for Outpoint<M> where
M: MarkedDigestOutput,
sourceimpl<M> Default for Outpoint<M> where
M: MarkedDigestOutput,
impl<M> Default for Outpoint<M> where
M: MarkedDigestOutput,
sourceimpl<'de, M> Deserialize<'de> for Outpoint<M> where
M: MarkedDigestOutput,
M: Deserialize<'de>,
impl<'de, M> Deserialize<'de> for Outpoint<M> where
M: MarkedDigestOutput,
M: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<M: Hash> Hash for Outpoint<M> where
M: MarkedDigestOutput,
impl<M: Hash> Hash for Outpoint<M> where
M: MarkedDigestOutput,
sourceimpl<M> Serialize for Outpoint<M> where
M: MarkedDigestOutput,
M: Serialize,
impl<M> Serialize for Outpoint<M> where
M: MarkedDigestOutput,
M: Serialize,
impl<M: Copy> Copy for Outpoint<M> where
M: MarkedDigestOutput,
impl<M: Eq> Eq for Outpoint<M> where
M: MarkedDigestOutput,
impl<M> StructuralEq for Outpoint<M> where
M: MarkedDigestOutput,
impl<M> StructuralPartialEq for Outpoint<M> where
M: MarkedDigestOutput,
impl<M> TxoIdentifier for Outpoint<M> where
M: MarkedDigestOutput,
Auto Trait Implementations
impl<M> RefUnwindSafe for Outpoint<M> where
M: RefUnwindSafe,
impl<M> Send for Outpoint<M> where
M: Send,
impl<M> Sync for Outpoint<M> where
M: Sync,
impl<M> Unpin for Outpoint<M> where
M: Unpin,
impl<M> UnwindSafe for Outpoint<M> where
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more