This repository contains a Rust implementation of a zigzag merge iterator. The iterator merges two iterators in a zigzag fashion, alternating between elements from each iterator.
- Custom iterator implementation using Rust's
Iteratortrait. - Unit tests to validate functionality.
To use the zigzag iterator, include the following in your Rust project:
use your_crate_name::zigzag_merge;
let iter1 = vec![1, 3, 5].into_iter();
let iter2 = vec![2, 4, 6].into_iter();
let merged = zigzag_merge(iter1, iter2);
for value in merged {
println!("{}", value);
}To run the tests for this implementation, use the following command:
cargo testThis project is licensed under the MIT License.