Struct near_pool::PoolIteratorWrapper [−][src]
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.
fn next(&mut self) -> Option<&mut TransactionGroup>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,