#iterator #traits #result #try #extension

tryiter

Utility functions for Iterators of Results

4 releases (2 breaking)

new 0.3.0 Dec 17, 2024
0.2.0 Nov 7, 2024
0.1.1 Nov 6, 2024
0.1.0 Nov 6, 2024

#1574 in Rust patterns

Download history 263/week @ 2024-11-01 67/week @ 2024-11-08 14/week @ 2024-11-15 3/week @ 2024-11-22 33/week @ 2024-12-06 118/week @ 2024-12-13

158 downloads per month

MIT/Apache

17KB
207 lines

tryiter

docs.rs crates.io Build Status

Utility functions for Iterators of Results. This crate is heavily inspired by TryStreamExt in the futures crate as well as Yoshua Wuyts post on Fallible Iterator Adapters.

TryIteratorExt

This crate exports a trait called TryIteratorExt which provides utility methods on top of any Iterator which returns a Result. TryIteratorExt is automatically implemented on top of compatible Iterators via a generic impl so all you have to do is import the trait and start calling methods on your iterators.

The methods provide two fundamental simplifications over regular Iterator methods:

  1. They operate directly on Ok or Err values, passing through the other values transparently.
  2. They take in fallible closures which can return Err.

See tests/sanity.rs for a quick overview of using this crate.

Release Stability

This crate is still pre-1.0 and will be until someone wants to use it in production. If you want to use it before that point please pin a specific version number and be prepared for breaking changes.

No runtime deps