-
Notifications
You must be signed in to change notification settings - Fork 13k
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
core: add a reverse method to Ordering. #16155
Conversation
/// assert_eq!(data, [10u, 8, 5, 2]); | ||
/// ``` | ||
#[inline] | ||
pub fn reverse(self) -> Ordering { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reversal iterator on iterators is called rev
(as a data point). I don't think we have conventions around this or anything, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was considering flip
too. (I want someone else to make the decision...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invert
is another option (yay bikeshedding).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there are no instances of flip
or invert
in the standard library, reverse
is used for mutably reversing a vector, and rev
is used for reversing a forward iterator. (not much precedent to draw from). So long as it's #[experimental]
it doesn't matter a whole lot.
Yay. I was just lamenting the lack of such a method earlier today. |
Could you also mark this method as |
r? |
This flips the comparison and is designed to be used when sorting etc.
This flips the comparison and is designed to be used when sorting etc.
fix: Dont assume ascii in remove_markdown Fixes rust-lang#16142
This flips the comparison and is designed to be used when sorting etc.