Merged
Conversation
Contributor
There was a problem hiding this comment.
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_countvia a newTryCountfuture and aStreamToolsextension method. - Bump crate version to
0.7.7, add crates.io categories, and updateCHANGELOG.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adding
try_countstream terminator.It counts the elements in a stream of results, or returns early if it finds an error.
Design
I just used the existing
TryStreamtrait 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 plainStream.Misc
Added crate categories to
Cargo.toml. Might help a little with discoverability.Also run
cargo fmtwhich made u bunch of small changes here and there.Issue refs
closes: #6