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

Implement Ord and PartialOrd for UniCase<AsRef<str>> #7

Merged
merged 1 commit into from
Dec 11, 2015

Conversation

frewsxcv
Copy link
Contributor

@frewsxcv frewsxcv commented Dec 5, 2015

No description provided.

@seanmonstar
Copy link
Owner

Implementing Ord makes sense. I see there isn't a cmp_ignore_case method for AsciiExt. Could we use memicmp for this on all platforms?

@frewsxcv
Copy link
Contributor Author

frewsxcv commented Dec 5, 2015

I'm not familiar with memicmp with Rust. Can you point me in the direction to learn more about how to move forward with it?

fn cmp(&self, other: &Self) -> Ordering {
let self_chars = self.as_ref().chars().map(|c| c.to_ascii_lowercase());
let other_chars = other.as_ref().chars().map(|c| c.to_ascii_lowercase());
self_chars.cmp(other_chars)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is using an unstable feature, so the tests don't pass on stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I could wait until Thursday :)

rust-lang/rust#29254

@frewsxcv frewsxcv closed this Dec 11, 2015
@frewsxcv frewsxcv reopened this Dec 11, 2015
@frewsxcv
Copy link
Contributor Author

Compiles on stable now :)

@seanmonstar
Copy link
Owner

Woo!

seanmonstar added a commit that referenced this pull request Dec 11, 2015
Implement Ord and PartialOrd for UniCase<AsRef<str>>
@seanmonstar seanmonstar merged commit d312548 into seanmonstar:master Dec 11, 2015
@frewsxcv frewsxcv deleted the ord branch February 11, 2016 00:38
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