Skip to content

iterator: don't erase the lifetime by using 'static #226

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

Merged
merged 3 commits into from
Mar 11, 2025

Conversation

muzarski
Copy link
Collaborator

@muzarski muzarski commented Mar 11, 2025

The iterators are borrowing from different types which are owners of the data. Let's emphasize it and introduce lifetime parameters to iterator types.

As a bonus, I replaced all .clone() with Arc::clone() in future.rs.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have implemented Rust unit tests for the features/changes introduced.
  • [ ] I have enabled appropriate tests in .github/workflows/build.yml in gtest_filter.
  • [ ] I have enabled appropriate tests in .github/workflows/cassandra.yml in gtest_filter.

cpp-driver does not increase the reference count. The lifetime
of the iterator is bound to the lifetime of result.
It's more readable (and safe) to have an explicit lifetime
instead of lifetime-erased references.
It's more readable and easier to spot where Arc cloning appears.
@muzarski muzarski requested review from wprzytula and Lorak-mmk March 11, 2025 12:40
@muzarski muzarski self-assigned this Mar 11, 2025
@muzarski muzarski added this to the 0.4 milestone Mar 11, 2025
@muzarski muzarski merged commit f80ae3b into scylladb:master Mar 11, 2025
11 checks passed
This was referenced Apr 10, 2025
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.

3 participants