Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fsmaxb/rust-adjacent-pair-iterator

A rust iterator that iterates over adjacent pairs in another iterator, e.g. (1,2,3) -> ((1,2),(2,3)).
https://github.com/fsmaxb/rust-adjacent-pair-iterator

Last synced: 2 months ago
JSON representation

A rust iterator that iterates over adjacent pairs in another iterator, e.g. (1,2,3) -> ((1,2),(2,3)).

Awesome Lists containing this project

README

        

# adjacent-pair-iterator
A `#![no_std]` library that takes an iterator and turns it into an iterator over adjacent pairs.

## Minimum rust version (MSRV)
This library works with Rust versions since 1.31.

## Example:
```rust
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)
```