TransactionBuilder

Struct TransactionBuilder 

Source
pub struct TransactionBuilder {
    pub version: Uint32,
    pub cell_deps: Vec<CellDep>,
    pub header_deps: Vec<Byte32>,
    pub inputs: Vec<CellInput>,
    pub outputs: Vec<CellOutput>,
    pub witnesses: Vec<Bytes>,
    pub outputs_data: Vec<Bytes>,
}
Expand description

An advanced builder for TransactionView.

Base on packed::TransactionBuilder but added lots of syntactic sugar.

Fields§

§version: Uint32§cell_deps: Vec<CellDep>§header_deps: Vec<Byte32>§inputs: Vec<CellInput>§outputs: Vec<CellOutput>§witnesses: Vec<Bytes>§outputs_data: Vec<Bytes>

Implementations§

Source§

impl TransactionBuilder

Source

pub fn get_cell_deps(&self) -> &Vec<CellDep>

Source

pub fn get_header_deps(&self) -> &Vec<Byte32>

Source

pub fn get_inputs(&self) -> &Vec<CellInput>

Source

pub fn get_outputs(&self) -> &Vec<CellOutput>

Source

pub fn get_witnesses(&self) -> &Vec<Bytes>

Source

pub fn get_outputs_data(&self) -> &Vec<Bytes>

Source§

impl TransactionBuilder

Source

pub fn version(self, v: Uint32) -> Self

Sets version.

Source

pub fn cell_dep(&mut self, v: CellDep) -> &mut Self

Pushes an item into cell_deps.

Source

pub fn cell_deps<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = CellDep>,

Extends cell_deps with the contents of an iterator.

Source

pub fn set_cell_deps(&mut self, v: Vec<CellDep>) -> &mut Self

Sets cell_deps.

Source

pub fn dedup_cell_dep(&mut self, v: CellDep) -> &mut Self

Pushes an item into cell_deps only if the same item is not already in.

Source

pub fn dedup_cell_deps<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = CellDep>,

Extends cell_deps with the contents of an iterator, skip already exist ones.

Source

pub fn header_dep(&mut self, v: Byte32) -> &mut Self

Pushes an item into header_deps.

Source

pub fn header_deps<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = Byte32>,

Extends header_deps with the contents of an iterator.

Source

pub fn set_header_deps(&mut self, v: Vec<Byte32>) -> &mut Self

Sets header_deps.

Source

pub fn dedup_header_dep(&mut self, v: Byte32) -> &mut Self

Pushes an item into header_deps only if the same item is not already in.

Source

pub fn dedup_header_deps<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = Byte32>,

Extends header_deps with the contents of an iterator, skip already exist ones.

Source

pub fn input(&mut self, v: CellInput) -> &mut Self

Pushes an item into inputs.

Source

pub fn inputs<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = CellInput>,

Extends inputs with the contents of an iterator.

Source

pub fn set_inputs(&mut self, v: Vec<CellInput>) -> &mut Self

Sets inputs.

Source

pub fn output(&mut self, v: CellOutput) -> &mut Self

Pushes an item into outputs.

Source

pub fn outputs<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = CellOutput>,

Extends outputs with the contents of an iterator.

Source

pub fn set_outputs(&mut self, v: Vec<CellOutput>) -> &mut Self

Sets outputs.

Source

pub fn set_output(&mut self, i: usize, v: CellOutput) -> &mut Self

Source

pub fn witness(&mut self, v: Bytes) -> &mut Self

Pushes an item into witnesses.

Source

pub fn witnesses<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = Bytes>,

Extends witnesses with the contents of an iterator.

Source

pub fn set_witnesses(&mut self, v: Vec<Bytes>) -> &mut Self

Sets witnesses.

Source

pub fn set_witness(&mut self, i: usize, v: Bytes) -> &mut Self

Source

pub fn output_data(&mut self, v: Bytes) -> &mut Self

Pushes an item into outputs_data.

Source

pub fn outputs_data<T>(&mut self, v: T) -> &mut Self
where T: IntoIterator<Item = Bytes>,

Extends outputs_data with the contents of an iterator.

Source

pub fn set_outputs_data(&mut self, v: Vec<Bytes>) -> &mut Self

Sets outputs_data.

Source

pub fn set_output_data(&mut self, i: usize, v: Bytes) -> &mut Self

Source

pub fn build(self) -> TransactionView

Converts into TransactionView.

Trait Implementations§

Source§

impl Clone for TransactionBuilder

Source§

fn clone(&self) -> TransactionBuilder

Returns a duplicate 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 TransactionBuilder

Source§

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

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

impl Default for TransactionBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Cast to trait Any
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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> Type2Any for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,