[][src]Struct ckb_std::high_level::QueryIter

pub struct QueryIter<F> { /* fields omitted */ }

QueryIter

A advanced iterator to manipulate cells/inputs/headers/witnesses

Example

use high_level::load_cell_capacity;
// calculate all inputs capacity
let inputs_capacity = QueryIter::new(load_cell_capacity, Source::Input)
.map(|capacity| capacity.unwrap_or(0))
.sum::<u64>();

// calculate all outputs capacity
let outputs_capacity = QueryIter::new(load_cell_capacity, Source::Output)
.map(|capacity| capacity.unwrap_or(0))
.sum::<u64>();

assert_eq!(inputs_capacity, outputs_capacity);

Methods

impl<F> QueryIter<F>[src]

pub fn new(query_fn: F, source: Source) -> Self[src]

new

Arguments

  • query_fn - A high level query function, which accept (index, source) as args and returns Result<T, SysError>. Examples: load_cell, load_cell_data,load_witness_args, load_input, load_header, ...
  • source - source

Example

use high_level::load_cell;
// iterate all inputs cells
let iter = QueryIter::new(load_cell, Source::Input)

Trait Implementations

impl<T, F: Fn(usize, Source) -> Result<T, SysError>> Iterator for QueryIter<F>[src]

type Item = T

The type of the elements being iterated over.

Auto Trait Implementations

impl<F> Send for QueryIter<F> where
    F: Send

impl<F> Sync for QueryIter<F> where
    F: Sync

impl<F> Unpin for QueryIter<F> where
    F: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> PackVec<Byte32Vec, Byte32> for T where
    T: IntoIterator<Item = Byte32>, 
[src]

impl<T> PackVec<BytesVec, Bytes> for T where
    T: IntoIterator<Item = Bytes>, 
[src]

impl<T> PackVec<CellDepVec, CellDep> for T where
    T: IntoIterator<Item = CellDep>, 
[src]

impl<T> PackVec<CellInputVec, CellInput> for T where
    T: IntoIterator<Item = CellInput>, 
[src]

impl<T> PackVec<CellOutputVec, CellOutput> for T where
    T: IntoIterator<Item = CellOutput>, 
[src]

impl<T> PackVec<ProposalShortIdVec, ProposalShortId> for T where
    T: IntoIterator<Item = ProposalShortId>, 
[src]

impl<T> PackVec<TransactionVec, Transaction> for T where
    T: IntoIterator<Item = Transaction>, 
[src]

impl<T> PackVec<UncleBlockVec, UncleBlock> for T where
    T: IntoIterator<Item = UncleBlock>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.