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

the actual helpful docs for std::cmp is under std::cmp::Ordering #32934

Closed
deepak opened this issue Apr 13, 2016 · 5 comments
Closed

the actual helpful docs for std::cmp is under std::cmp::Ordering #32934

deepak opened this issue Apr 13, 2016 · 5 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority

Comments

@deepak
Copy link
Contributor

deepak commented Apr 13, 2016

rust noob here, looked up rustdoc for std::cmp
and realised that the meat of the docs and examples are under std::cmp::Ordering

should it be brought up from std::cmp::Ordering to std::cmp ?

@deepak deepak changed the title rustdoc: the actual helpful docs for std::cmp are under std::cmp::Ordering rustdoc: the actual helpful docs for std::cmp is under std::cmp::Ordering Apr 13, 2016
@GuillaumeGomez
Copy link
Member

std::cmp is a module whereas std::cmp::Ordering is an enum. It seems more logical to have specific examples on a type and more global ones (or just a global explanation) in the parent module.

@steveklabnik
Copy link
Member

part of #29329

@nodakai
Copy link
Contributor

nodakai commented Apr 17, 2016

@GuillaumeGomez Trying to be "logical" sounds nice except your argument is not.

Given that either the Ordering enum or the PartialOrd trait alone cannot implement user-defined ordering, we can "logically" say the meat of the documents should not belong to either of them.

@frewsxcv
Copy link
Member

and realised that the meat of the docs and examples are under std::cmp::Ordering

In particular, which sections of std::cmp::Ordering did you wish were in std::cmp? The docs for std::cmp::Ordering look pretty bare right now.

@deepak
Copy link
Contributor Author

deepak commented Dec 29, 2016

in particular, which sections of std::cmp::Ordering did you wish were in std::cmp

am still a rust noob. so may be wildly wrong
but it seems as if, std::cmd is useful for both:

  1. implementing equality and ordering. need the traits there
  2. comparing "stuff" implemented with (1). need the Ordering enum here

as a casual user of rust, expected using Ordering to be more important than implementing
traits in std::cmp. in hindsight, this was a bad assumption on my part (maybe)

knee jerk reaction on my part. thinking.

"
i just want to compare two values.
....bit of searching.
Oh. so i need the Ordering enum
"

i guess, it is evident now that:
traits are for implementing stuff
and Enums are for using it

suggestions:

  1. docs for std::cmp has examples for both
    • using Ordering
    • implementing a custom ordering
  2. a link to Ordering in the text as well

also the example for std::cmp does not tell me anything about using the module

@steveklabnik steveklabnik added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Mar 10, 2017
@steveklabnik steveklabnik added P-medium Medium priority and removed A-docs labels Mar 22, 2017
@frewsxcv frewsxcv added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools and removed T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 25, 2017
@frewsxcv frewsxcv changed the title rustdoc: the actual helpful docs for std::cmp is under std::cmp::Ordering the actual helpful docs for std::cmp is under std::cmp::Ordering Mar 29, 2018
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jan 11, 2019
pietroalbini added a commit to pietroalbini/rust that referenced this issue Jan 12, 2019
Centril added a commit to Centril/rust that referenced this issue Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

6 participants