[][src]Struct miniscript::miniscript::iter::Iter

pub struct Iter<'a, Pk: 'a + MiniscriptKey, Ctx: 'a + ScriptContext> { /* fields omitted */ }

Iterator for traversing all Miniscript miniscript AST references starting from some specific node which constructs the iterator via Miniscript::iter method.

Trait Implementations

impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> Iterator for Iter<'a, Pk, Ctx>[src]

type Item = &'a Miniscript<Pk, Ctx>

The type of the elements being iterated over.

pub fn next(&mut self) -> Option<Self::Item>[src]

First, the function returns self, then the first child of the self (if any), then proceeds to the child of the child — down to a leaf of the tree in its first branch. When the leaf is reached, it goes in the reverse direction on the same branch until it founds a first branching node that had more than a single branch and returns it, traversing it with the same algorithm again.

For example, for the given AST

A --+--> B -----> C --+--> D -----> E
    |                 |
    |                 +--> F
    |                 |
    |                 +--> G --+--> H
    |                          |
    |                          +--> I -----> J
    +--> K

Iter::next() will iterate over the nodes in the following order: A > B > C > D > E > F > G > H > I > J > K

To enumerate the branches iterator uses Miniscript::branches function.

Auto Trait Implementations

impl<'a, Pk, Ctx> RefUnwindSafe for Iter<'a, Pk, Ctx> where
    Ctx: RefUnwindSafe,
    Pk: RefUnwindSafe,
    <Pk as MiniscriptKey>::Hash: RefUnwindSafe

impl<'a, Pk, Ctx> Send for Iter<'a, Pk, Ctx> where
    Ctx: Send + Sync,
    Pk: Send + Sync,
    <Pk as MiniscriptKey>::Hash: Send + Sync

impl<'a, Pk, Ctx> Sync for Iter<'a, Pk, Ctx> where
    Ctx: Send + Sync,
    Pk: Send + Sync,
    <Pk as MiniscriptKey>::Hash: Send + Sync

impl<'a, Pk, Ctx> Unpin for Iter<'a, Pk, Ctx>

impl<'a, Pk, Ctx> UnwindSafe for Iter<'a, Pk, Ctx> where
    Ctx: RefUnwindSafe,
    Pk: RefUnwindSafe,
    <Pk as MiniscriptKey>::Hash: RefUnwindSafe

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