Skip to content

Add size_hint for OptionEnumerator#58

Merged
aarkegz merged 3 commits intodevfrom
option_size_hint
Jul 12, 2025
Merged

Add size_hint for OptionEnumerator#58
aarkegz merged 3 commits intodevfrom
option_size_hint

Conversation

@aarkegz
Copy link
Contributor

@aarkegz aarkegz commented Jul 12, 2025

No description provided.

@aarkegz aarkegz requested a review from Copilot July 12, 2025 13:13
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

This PR adds a size_hint implementation for the OptionEnumerator iterator to provide bounds information about the number of remaining elements. The implementation accounts for whether the None variant has already been yielded by the iterator.

  • Implements the size_hint method for OptionEnumerator that adds 1 to the inner iterator's bounds when the None variant hasn't been yielded yet
  • Updates test to use a new assertion function that validates size hint behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/impl_built_in.rs Adds size_hint method implementation to OptionEnumerator with proper bound calculation
src/test/mod.rs Updates test to use new assertion function that validates size hint behavior

aarkegz and others added 2 commits July 12, 2025 21:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aarkegz aarkegz merged commit f407f9d into dev Jul 12, 2025
10 checks passed
@aarkegz aarkegz deleted the option_size_hint branch July 12, 2025 13:19
@aarkegz aarkegz added this to the v1.2 milestone Jul 12, 2025
@aarkegz aarkegz added the enhancement New feature or request label Jul 12, 2025
@aarkegz aarkegz self-assigned this Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants