try-iterator 1.0.0

Adds a few fallible methods to iterators.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented7 out of 7 items with examples
  • Size
  • Source code size: 16.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 584.36 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • rodrigocfd/try-iterator
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rodrigocfd

TryIterator

Crates.io Docs.rs Lines of code License: MIT

Implements the TryIterator trait, which will add the following fallible methods to Iterator:

New method Analog to
try_all all
try_any any
try_position position
try_rposition rposition

Motivation

This crate was born out of necessity of a fallible version for the Iterator::position method, which was asked in this StackOverflow question. Contrary to the equivalent try_for_each, the solution is rather cumbersome, which resulted in this issue in the Rust repository.

Until the standard library adds these fallible methods – if ever –, they are available in this crate.

Usage

Add the dependency in your Cargo.toml:

[dependencies]
try-iterator = { version = "1.0.0" }

Then import the prelude at the top of your source files:

use try_iterator::prelude::*;

The new methods will be automatically present in Iterator.

License

Licensed under MIT license, see LICENSE.md for details.