putbackpeekmore 0.1.2

A no_std iterator that lets you do useful things such as peeking at more than one value and putting back a value.
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented0 out of 6 items with examples
  • Size
  • Source code size: 8.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 307.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • EvoPot

About

A no_std Rust iterator for doing useful things such as putting back, and peeking more. It uses no clone or copy.

How to use

use putbackpeekmore::PutBackPeekMore;

fn main() {
    // Create a new iterator :
    let mut iter: PutBackPeekMore<_, 7> = PutBackPeekMore::new(0..10); // The 7 is the "peek buffer size". Keep in mind that if you make this value too small it will result in garbage data.

    // Look at the next value of the iterator
    assert_eq!(iter.peek(), &Some(0));

    // Consume the iterator
    assert_eq!(iter.next(), Some(0));

    //Peek a certain amount
    assert_eq!(iter.peek_value(3), &[Some(1), Some(2), Some(3)]);

    // Put back a value
    iter.put_back(Some(0));
    assert_eq!(iter.next(), Some(0));
}