yewstack / implicit-clone

Immutable types and ImplicitClone trait similar to Copy
19 stars 10 forks source link

Add impl for PartialOrd, Ord, reverse PartialEq #27

Closed kirillsemyonkin closed 1 year ago

kirillsemyonkin commented 1 year ago

This PR implements PartialOrd and Ord for IString, fixes #18, additionally adds more implementations for reverse comparisons (str = IString, as opposed to usual IString = str).

It adds an impl_cmp_as_str! macro which allows to list implementations easily by mentioning the trait name and pairs for which to implement the trait.

It also updates tests using macros to list more possible usage variants (comparing IStrings of different enum variants for all tests, reverse comparisons, adding tests for PartialOrd and Ord).