Skip to content

Add try_count#7

Merged
extremeandy merged 4 commits intoextremeandy:masterfrom
Iizuki:try_collect
Mar 20, 2026
Merged

Add try_count#7
extremeandy merged 4 commits intoextremeandy:masterfrom
Iizuki:try_collect

Conversation

@Iizuki
Copy link
Contributor

@Iizuki Iizuki commented Mar 19, 2026

Summary

Adding try_count stream terminator.

It counts the elements in a stream of results, or returns early if it finds an error.

Design

I just used the existing TryStream trait as the bound as it's nice and concise. I'm not aware of any downsides compared to specifying the bound more verbosely in terms of plain Stream.

Misc

Added crate categories to Cargo.toml. Might help a little with discoverability.

Also run cargo fmt which made u bunch of small changes here and there.

Issue refs

closes: #6

@extremeandy extremeandy requested a review from Copilot March 19, 2026 11:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new StreamTools::try_count() terminator to count Ok items in a TryStream while short-circuiting on the first Err, alongside a version bump + changelog entry and some cargo fmt import/semicolon cleanups.

Changes:

  • Introduce try_count via a new TryCount future and a StreamTools extension method.
  • Bump crate version to 0.7.7, add crates.io categories, and update CHANGELOG.md.
  • Apply formatting/import-order adjustments across several modules.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/try_count.rs New TryCount future implementing the short-circuiting count logic.
src/lib.rs Wires try_count into StreamTools and adds the new module.
src/throttle_last.rs Formatting/import-order and missing semicolon fix.
src/test_util/delay_items.rs Import order formatting.
src/sample.rs Formatting/import-order and semicolon fix.
src/merge_join_by.rs Import order formatting.
src/flatten_switch.rs Import order formatting.
src/fast_forward.rs Import order formatting and semicolon fix.
build.rs Import order formatting.
Cargo.toml Version bump to 0.7.7 and add crate categories.
CHANGELOG.md Add 0.7.7 entry noting try_count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@extremeandy extremeandy merged commit 01cba7d into extremeandy:master Mar 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: try_count

3 participants