Skip to content

improve iterators3 to demonstrate collect() type-driven behavior#2333

Open
leochen4891 wants to merge 1 commit intorust-lang:mainfrom
leochen4891:improve_iterator3
Open

improve iterators3 to demonstrate collect() type-driven behavior#2333
leochen4891 wants to merge 1 commit intorust-lang:mainfrom
leochen4891:improve_iterator3

Conversation

@leochen4891
Copy link
Copy Markdown

@leochen4891 leochen4891 commented Jan 17, 2026

  • No change to the existing solution
  • Use simpler numbers for easier mental math (9, 12, 18, 6 ÷ 3)
  • Add function parameters to allow testing different inputs
  • Add error case tests to show fail-fast vs process-all behavior
  • Enhance comments explaining Result<Vec> vs Vec<Result>

  - Use simpler numbers for easier mental math (9, 12, 18, 6 ÷ 3)
  - Add function parameters to allow testing different inputs
  - Add error case tests to show fail-fast vs process-all behavior
  - Enhance comments explaining Result<Vec<T>> vs Vec<Result<T>>
@senekor
Copy link
Copy Markdown
Contributor

senekor commented May 3, 2026

I don't think this adds any value.

  • Users don't have to do the math, those who want to might enjoy the challenge.
  • The error case test doesn't actually demonstrate fail-fast behavior. It only shows that the first error is returned, not that the subsequent values are never processed.
  • The additional comments remove the last mystery for users to figure out on their own. The hint already contains all the information necessary for people who can't figure it out on their own.

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.

2 participants