Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify Iterators definition #143

Closed
wants to merge 1 commit into from
Closed

simplify Iterators definition #143

wants to merge 1 commit into from

Conversation

gwbres
Copy link
Collaborator

@gwbres gwbres commented Aug 28, 2023

Simplify returned type, when we return an Iterator : it never requires it to be Box'ed

Signed-off-by: Guillaume W. Bres <[email protected]>
@gwbres gwbres added the enhancement New feature provided label Aug 28, 2023
@gwbres gwbres added this to the v1.0.0 milestone Aug 28, 2023
@gwbres gwbres requested a review from lnicola August 28, 2023 09:54
@gwbres gwbres self-assigned this Aug 28, 2023
@gwbres
Copy link
Collaborator Author

gwbres commented Aug 28, 2023

@lnicola,

there are a few spots where I can't see to remove the Box, why is that ?

For example, this does not compile
image

Hum.. this raises severe problems

image

@gwbres gwbres linked an issue Aug 28, 2023 that may be closed by this pull request
@lnicola
Copy link
Member

lnicola commented Aug 28, 2023

Yeah, that won't work. The reason is that impl Iterator is always a single type, but the code in the screenshot would return 5 different types. TBH, maybe Box<dyn Iterator> is not a a terrible choice, as some people don't really like impl Trait return types anyway. I was just pointing out it's an option there.

@gwbres
Copy link
Collaborator Author

gwbres commented Aug 28, 2023

The reason is that impl Iterator is always a single type, but the code in the screenshot would return 5 different types

the returned type is the same, in the sense they're all Iterators over an Epoch, but the iterator source is different that is true

@lnicola
Copy link
Member

lnicola commented Aug 28, 2023

The closures are also different types, even if they have the same arguments and return value (and I'm not sure these ones do).

@gwbres gwbres closed this Oct 6, 2024
@gwbres gwbres deleted the rinex-iter branch October 6, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RINEX: simplify Iterators definition to return "impl Iterator"
2 participants