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

Can we make the contains_key to &self #27

Closed
hengfeiyang opened this issue Apr 22, 2024 · 3 comments
Closed

Can we make the contains_key to &self #27

hengfeiyang opened this issue Apr 22, 2024 · 3 comments

Comments

@hengfeiyang
Copy link

hengfeiyang commented Apr 22, 2024

Now the contains_key define like this

pub fn contains_key<Q>(&mut self, key: &Q) -> bool

But this function don't need update the order of element right, it only check the element is exist or not. Can we change it like this:

pub fn contains_key<Q>(&self, key: &Q) -> bool

Or add a new function like this:

pub fn contains_key_mut<Q>(&mut self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool

Like standard HashMap: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.contains_key

@kyren
Copy link
Owner

kyren commented Apr 22, 2024

I have no earthly idea why that method takes &mut self, fixing it.

@kyren kyren closed this as completed in 83c137e Apr 22, 2024
@hengfeiyang
Copy link
Author

Can you publish a new release? i want to use this feature. thank you.

@kyren kyren reopened this Apr 22, 2024
@kyren
Copy link
Owner

kyren commented Apr 22, 2024

I'll make a release soon and leave this issue open until I do

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

No branches or pull requests

2 participants