[][src]Macro chained_iter::chained_iter

macro_rules! chained_iter {
    ($elem: expr) => { ... };
    ($first: expr, $($rest: expr), + $(,)?) => { ... };
}

Creates an Iterator containing the arguments, as a Chain of Once iterators.

The created iterator allows arguments to be moved out of the iterator, and does not allocate.

This is equivalent to creating a Vec and using into_iter, but without the heap allocation. Alternatively, this has similar behaviour as the feature array_value_iter, but is permissible in stable Rust, without the need for const generics.

Example

use chained_iter::chained_iter;
assert_eq!(vec![1, 2, 3, 4], chained_iter![1, 2, 3, 4].collect::<Vec<_>>());