pub struct TransactionView { /* private fields */ }
Expand description

A readonly and immutable struct which includes Transaction and its associated hashes.

Notice

This struct is not implement the trait Default, use TransactionBuilder to construct it.

Implementations§

source§

impl TransactionView

source

pub fn new_advanced_builder() -> TransactionBuilder

Creates an empty advanced builder.

source

pub fn as_advanced_builder(&self) -> TransactionBuilder

Creates an advanced builder base on current data.

source§

impl TransactionView

source

pub fn data(&self) -> Transaction

Gets a clone of packed::Transaction.

source

pub fn hash(&self) -> Byte32

Gets a clone of hash.

source

pub fn witness_hash(&self) -> Byte32

Gets a clone of witness_hash.

source

pub fn version(&self) -> Version

Gets raw.version.

source

pub fn cell_deps(&self) -> CellDepVec

Gets raw.cell_deps.

source

pub fn header_deps(&self) -> Byte32Vec

Gets raw.header_deps.

source

pub fn inputs(&self) -> CellInputVec

Gets raw.inputs.

source

pub fn outputs(&self) -> CellOutputVec

Gets raw.outputs.

source

pub fn outputs_data(&self) -> BytesVec

Gets raw.outputs_data.

source

pub fn witnesses(&self) -> BytesVec

Gets witnesses.

source

pub fn output(&self, idx: usize) -> Option<CellOutput>

Gets an output through its index.

source

pub fn output_with_data(&self, idx: usize) -> Option<(CellOutput, Bytes)>

Gets an output and its data through its index.

source

pub fn output_pts(&self) -> Vec<OutPoint>

Gets out points for all outputs.

source

pub fn output_pts_iter(&self) -> impl Iterator<Item = OutPoint>

Creates an iterator from out points of all outputs.

source

pub fn input_pts_iter(&self) -> impl Iterator<Item = OutPoint>

Creates an iterator from out points of all inputs.

source

pub fn outputs_with_data_iter( &self ) -> impl Iterator<Item = (CellOutput, Bytes)>

Creates an iterator from all outputs and their data.

source

pub fn cell_deps_iter(&self) -> impl Iterator<Item = CellDep>

Creates an iterator from raw.cell_deps.

source

pub fn header_deps_iter(&self) -> impl Iterator<Item = Byte32>

Creates an iterator from raw.header_deps.

source

pub fn fake_hash(self, hash: Byte32) -> Self

Sets a fake transaction hash.

source

pub fn fake_witness_hash(self, witness_hash: Byte32) -> Self

Sets a fake witness hash.

source

pub fn outputs_capacity(&self) -> CapacityResult<Capacity>

Sums the capacities of all outputs.

source

pub fn is_cellbase(&self) -> bool

Checks whether the transaction is a cellbase.

source

pub fn proposal_short_id(&self) -> ProposalShortId

Creates a new ProposalShortId from the transaction hash.

Trait Implementations§

source§

impl Clone for TransactionView

source§

fn clone(&self) -> TransactionView

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for TransactionView

source§

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

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

impl Display for TransactionView

source§

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

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

impl Hash for TransactionView

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Pack<TransactionView> for TransactionView

source§

fn pack(&self) -> TransactionView

Packs a rust type into binary data.
source§

impl PartialEq<TransactionView> for TransactionView

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Unpack<TransactionView> for TransactionView

source§

fn unpack(&self) -> TransactionView

Unpack binary data into rust types.
source§

impl<'r> Unpack<TransactionView> for TransactionViewReader<'r>

source§

fn unpack(&self) -> TransactionView

Unpack binary data into rust types.
source§

impl Eq for TransactionView

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V