Skip to main content

TransactionSpentOutputs

Struct TransactionSpentOutputs 

Source
pub struct TransactionSpentOutputs { /* private fields */ }
Expand description

Spent output data for a single transaction.

Contains all the coins (UTXOs) that were consumed by a specific transaction’s inputs, in the same order as the inputs. Each coin represents a previous transaction output that was spent.

§Thread Safety

TransactionSpentOutputs is both Send and Sync.

§Examples

// Get spent outputs for the second transaction in a block
let tx_spent = block_spent.transaction_spent_outputs(0)?;

// Iterate through the coins
for coin in tx_spent.coins() {
    println!("Input spent: {} satoshis", coin.output().value());
    println!("Output was created at height: {}", coin.confirmation_height());
}

Implementations§

Source§

impl TransactionSpentOutputs

Source

pub fn as_ref(&self) -> TransactionSpentOutputsRef<'_>

Creates a borrowed reference to these spent outputs.

This allows converting from owned TransactionSpentOutputs to TransactionSpentOutputsRef without copying the underlying data.

§Lifetime

The returned reference is valid for the lifetime of the TransactionSpentOutputs.

Trait Implementations§

Source§

impl Clone for TransactionSpentOutputs

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionSpentOutputs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for TransactionSpentOutputs

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl TransactionSpentOutputsExt for TransactionSpentOutputs

Source§

fn count(&self) -> usize

Returns the number of coins (outputs) spent by this transaction. Read more
Source§

fn coin(&self, coin_index: usize) -> Result<CoinRef<'_>, KernelError>

Returns a reference to the coin at the specified input index. Read more
Source§

fn coins(&self) -> TransactionSpentOutputsIter<'_>

Returns an iterator over the coins spent by this transaction. Read more
Source§

impl Send for TransactionSpentOutputs

Source§

impl Sync for TransactionSpentOutputs

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.