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

Port is_subset toTreeMap #112

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Port is_subset toTreeMap #112

merged 1 commit into from
Jul 17, 2023

Conversation

ariesdevil
Copy link
Contributor

Port is_subset to TreeMap

Copy link
Member

@Dr-Emann Dr-Emann left a comment

Choose a reason for hiding this comment

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

Small nit about indentation, otherwise looks good to me

croaring/src/treemap/imp.rs Show resolved Hide resolved
Copy link
Member

@Dr-Emann Dr-Emann left a comment

Choose a reason for hiding this comment

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

Looks good to me. I added a shorter version, but I'd be fine with what you have.

Comment on lines +673 to +686
for (k, v) in self.map.iter() {
if v.is_empty() {
continue;
}
match other.map.get(k) {
None => return false,
Some(other_v) => {
if !v.is_subset(other_v) {
return false;
}
}
}
}
true
Copy link
Member

Choose a reason for hiding this comment

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

Depends on how you feel, noting that this could be written more shortly as

self.map.iter().all(|(key, lhs)| {
    lhs.is_empty() || other.map.get(key).map_or(false, |rhs| lhs.is_subset(rhs))
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So if it's accepted, let's merge it?

@saulius saulius merged commit 13a71b4 into RoaringBitmap:master Jul 17, 2023
12 checks passed
@ariesdevil ariesdevil deleted the dev branch July 17, 2023 07:46
@saulius
Copy link
Member

saulius commented Jul 17, 2023

Thanks for the contribution @ariesdevil! This will be part of 1.0 containing some future-proof, yet breaking changes.

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.

None yet

3 participants