Crates.io | adjacent-pair-iterator |
lib.rs | adjacent-pair-iterator |
version | 1.0.0 |
source | src |
created_at | 2019-05-24 19:25:28.440299 |
updated_at | 2021-11-09 12:26:46.777638 |
description | An iterator over adjacent pairs in another iterator. |
homepage | https://github.com/FSMaxB/rust-adjacent-pair-iterator |
repository | https://github.com/FSMaxB/rust-adjacent-pair-iterator |
max_upload_size | |
id | 136758 |
size | 14,147 |
A #![no_std]
library that takes an iterator and turns it into an iterator over adjacent pairs.
This library works with Rust versions since 1.31.
use adjacent_pair_iterator::AdjacentPairIterator;
pub fn main() {
let vector = vec![1, 2, 3, 4];
for pair in vector.adjacent_pairs() {
println!("{:?}", pair);
}
}
Prints:
(1, 2)
(2, 3)
(3, 4)