Skip to content

Commit

Permalink
tweak workflow, update readme with badges
Browse files Browse the repository at this point in the history
  • Loading branch information
carlsverre committed Nov 6, 2024
1 parent 9fb78d0 commit ef8f8e2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ name: Build + Test

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Check
run: cargo check --verbose
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Check
run: cargo check --verbose
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# tryiter
<h1 align="center">tryiter</h1>
<p align="center">
<a href="https://docs.rs/tryiter">
<img alt="docs.rs" src="https://img.shields.io/docsrs/tryiter">
</a>
<a href="https://crates.io/crates/tryiter">
<img alt="crates.io" src="https://img.shields.io/crates/v/tryiter.svg">
</a>
<a href="https://github.com/carlsverre/tryiter/actions">
<img alt="Build Status" src="https://github.com/carlsverre/tryiter/actions/workflows/rust.yml/badge.svg">
</a>
</p>


Utility functions for Iterators of Results. This crate is heavily inspired by [TryStreamExt] in the [futures] crate.

[futures]: https://docs.rs/futures
Expand All @@ -7,3 +20,14 @@ Utility functions for Iterators of Results. This crate is heavily inspired by [T
## `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.

**Example:**
```rust
use tryiter::TryIteratorExt;

let iter = vec![Ok(1), Ok(2), Ok(3), Err("error")].into_iter();
let mut evens = iter.try_filter(|x| x % 2 == 0);

assert_eq!(evens.next(), Some(Ok(2)));
assert_eq!(evens.next(), Some(Err("error")));
```

0 comments on commit ef8f8e2

Please sign in to comment.