Skip to content

Conversation

nightkr
Copy link
Contributor

@nightkr nightkr commented Aug 9, 2024

Description

This is an alternative to

if cond {
    // must collect here, since foo.rev() is a distinct type from foo
    foo.rev().collect::<Vec<_>>()
} else {
    foo.collect()
}

That is both much more convenient to use and avoids the buffering and allocation.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes
# Author
# Reviewer
- [ ] Code contains useful comments
- [ ] (Integration-)Test cases added
- [ ] Documentation added or updated
- [ ] Changelog updated
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
# Acceptance
- [ ] Feature Tracker has been updated
- [ ] Proper release label has been added

@nightkr nightkr marked this pull request as ready for review August 9, 2024 14:28
@nightkr nightkr requested a review from a team August 9, 2024 14:29
Copy link
Member

@NickLarsenNZ NickLarsenNZ left a comment

Choose a reason for hiding this comment

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

The impl looks good to me. I am curious about two things:

  • how this came to be (where will it be used)
  • what does marble mean in the tests?

@nightkr
Copy link
Contributor Author

nightkr commented Aug 9, 2024

how this came to be (where will it be used)

https://github.com/stackabletech/hdfs-operator/blob/808f926dc0ad585bac972b0817f1a8548f524725/rust/operator-binary/src/hdfs_controller.rs#L334-L344

what does marble mean in the tests?

The style of black-box testing iterator/async implementation as "this sequence of inputs should generate this sequence of outputs". I originally got it from Rx (where it's both a helpful education tool and a testing framework).

@nightkr nightkr added this pull request to the merge queue Aug 12, 2024
Merged via the queue into main with commit a796eed Aug 12, 2024
20 checks passed
@nightkr nightkr deleted the feature/iter-reverse-if branch August 12, 2024 11:22
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