Struct ark_std::iterable::Reverse

source ·
pub struct Reverse<I>(pub I)
where
    I: Iterable,
    I::Iter: DoubleEndedIterator
;
Expand description

Stream that goes over an [ExactSizeIterator] in reverse order.

This stream allows to switch fast from little endian ordering used in time-efficient algorithms, e.g. in slices &[T] into big endia ordering (used in space-efficient algorithms.

Examples

use ark_std::iterable::{Iterable, Reverse};

let le_v = &[1, 2, 3];
let be_v = Reverse(le_v);
let mut be_v_iter = be_v.iter();
assert_eq!(be_v_iter.next(), Some(&3));
assert_eq!(be_v_iter.next(), Some(&2));
assert_eq!(be_v_iter.next(), Some(&1));

Tuple Fields§

§0: I

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
The type of the element being streamed.
The type of the iterator being generated.
Return the iterator associated to the current instance. Read more
Return a hint on the length of the stream. Read more
Return true if the stream is empty, else false.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.