xorf icon indicating copy to clipboard operation
xorf copied to clipboard

contains should allow borrowed types

Open djugei opened this issue 1 year ago • 2 comments

https://github.com/ayazhafiz/xorf/blob/108d67903f2df6db6dcd1c05c571594c529413d6/src/lib.rs#L119

it would be cool if one could query a Filter<Box<T>> using .contains(&T) instead of .contains(&Box<T>).

std achieves this by using the Borrow Trait.

this is a breaking change and requires a major release.

if the maintainers would like to have this feature i am willing to implement it.

djugei avatar Dec 31 '23 13:12 djugei

This sounds reasonable, feel free to implement.

Why is this a breaking change? Borrow<T> is uniformly implemented for &T so the existing API should hold.

On Sun, Dec 31, 2023 at 7:53 AM djugei @.***> wrote:

https://github.com/ayazhafiz/xorf/blob/108d67903f2df6db6dcd1c05c571594c529413d6/src/lib.rs#L119

it would be cool if one could query a Filter<Box<T>> using .contains(&T) instead of .contains(&Box<T>).

std https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.contains_key achieves this by using the Borrow Trait.

this is a breaking change and requires a major release.

if the maintainers would like to have this feature i am willing to implement it.

— Reply to this email directly, view it on GitHub https://github.com/ayazhafiz/xorf/issues/82, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6GL6SW7ZUMQVKBT3RPNPTYMFU6NAVCNFSM6AAAAABBIIV4TGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DCMBWG4YTSMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ayazhafiz avatar Dec 31 '23 15:12 ayazhafiz