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

Return Id<DP::P> over &Id<DP::P> #295

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Return Id<DP::P> over &Id<DP::P> #295

merged 1 commit into from
Dec 12, 2024

Conversation

konstin
Copy link
Member

@konstin konstin commented Dec 11, 2024

It's more efficient to return a u32 than to return a reference, and it avoids a borrow when returning it.

It's more efficient to return a u32 than a reference, and it avoids a borrow when returning it.
@konstin konstin force-pushed the konsti/dev/no-id-pointer branch from 1a0c3ff to 4739aaf Compare December 11, 2024 19:47
@@ -246,8 +246,10 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
}

/// Iterate over packages.
pub(crate) fn iter(&self) -> impl Iterator<Item = (&Id<P>, &Term<VS>)> {
self.package_terms.iter()
pub(crate) fn iter(&self) -> impl Iterator<Item = (Id<P>, &Term<VS>)> {
Copy link
Member Author

Choose a reason for hiding this comment

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

The plan is to expose this iterator from unit propagation and adding dependencies to allow tracking conflicts in the caller.

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Probably worth waiting for @Eh2406's review too.

@Eh2406 Eh2406 added this pull request to the merge queue Dec 12, 2024
Merged via the queue into dev with commit 7105f8d Dec 12, 2024
6 checks passed
@Eh2406 Eh2406 deleted the konsti/dev/no-id-pointer branch December 12, 2024 22:38
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