Struct near_pool::PoolIteratorWrapper[][src]

pub struct PoolIteratorWrapper<'a> { /* fields omitted */ }

PoolIterator is a structure to pull transactions from the pool. It implements PoolIterator trait that iterates over transaction groups one by one. When the wrapper is dropped the remaining transactions are returned back to the pool.

Implementations

impl<'a> PoolIteratorWrapper<'a>[src]

pub fn new(pool: &'a mut TransactionPool) -> Self[src]

Trait Implementations

impl<'a> Drop for PoolIteratorWrapper<'a>[src]

When a pool iterator is dropped, all remaining non empty transaction groups from the sorted groups queue are inserted back into the pool. And removed transactions hashes from groups are removed from the pool’s unique_transactions.

impl<'a> PoolIterator for PoolIteratorWrapper<'a>[src]

The iterator works with the following algorithm: On next(), the iterator tries to get a transaction group from the pool, sorts transactions in it, and add it to the back of the sorted groups queue. Remembers the last used key, so it can continue from the next key.

If the pool is empty, the iterator gets the group from the front of the sorted groups queue.

If this group is empty (no transactions left inside), then the iterator discards it and updates unique_transactions in the pool. Then gets the next one.

Once a non-empty group is found, this group is pushed to the back of the sorted groups queue and the iterator returns a mutable reference to this group.

If the sorted groups queue is empty, the iterator returns None.

When the iterator is dropped, unique_transactions in the pool is updated for every group. And all non-empty group from the sorted groups queue are inserted back into the pool.

Auto Trait Implementations

impl<'a> RefUnwindSafe for PoolIteratorWrapper<'a>

impl<'a> Send for PoolIteratorWrapper<'a>

impl<'a> Sync for PoolIteratorWrapper<'a>

impl<'a> Unpin for PoolIteratorWrapper<'a>

impl<'a> !UnwindSafe for PoolIteratorWrapper<'a>

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<T> Same<T> for T

type Output = T

Should always be Self

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.

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