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

impl compare<T, Q> for Natural<T> where T: Borrow<Q> #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seekstar
Copy link

I need to compare String and str in my data structure, and this PR enables Natural to do that by allowing comparison between all types and their borrowed representation.

@tisonkun
Copy link

@seekstar I meet this similar issue and use comapre::natural::<str>().borrowing() to implement. This should work for you also :D

@seekstar
Copy link
Author

Thank you for the suggestion. But in fact I'm using compare to constrain the argument type of an interface, where Q is the type of key to search in a tree of T, and therefore T and Q is not necessarily String and str. I think in my case impl compare<T, Q> for Natural<T> where T: Borrow<Q> is more suitable.

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.

2 participants