kyren / hashlink

An updated version of linked-hash-map and friends
Apache License 2.0
98 stars 18 forks source link

Can we make the contains_key to &self #27

Closed hengfeiyang closed 6 months ago

hengfeiyang commented 6 months ago

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 commented 6 months ago

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

hengfeiyang commented 6 months ago

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

kyren commented 6 months ago

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