rust-num / num-traits

Numeric traits for generic mathematics in Rust
Apache License 2.0
732 stars 135 forks source link

Documentation lacks a clear explanation of what num-traits does #183

Open Rik-de-Kort opened 4 years ago

Rik-de-Kort commented 4 years ago

"Numeric traits for generic mathematics in Rust." is a nice concise one-line description of num_traits. There's just one problem: I have no clue what the crate actually does! Provide traits involving numbers, sure. But why would I want to use num_traits? What problem does it solve? How will I know it's the right crate for my problem? How do I use it? After having a look at the documentation to docs.rs, I'm still mystified.
I was able to guess that num depended on num-traits, so that at least gave me some clarity, and I think I understand well enough what the envisioned use is, but the point is that the documentation provides no help whatsoever.
Additionally, for a crate like num I would expect a user guide with abundant examples for all the constructs (similar to pandas in the Python ecosystem), but I can't find this from docs.rs either.

I realize the above is a bit of a flame, but I think it's an important signal. Do with it what you will.

cuviper commented 4 years ago

We could certainly use better documentation here. Unfortunately, I don't have a lot of time for this crate, nor the skill-set to write a thorough user guide. Cliche as it is in open source -- contributions are welcome.

At least for the intro blurb -- the point is that numeric traits let you write code for generic number types. The std::ops traits get you the basic operators, but num-traits provides further traits like Zero/One identities, numeric conversions in To/FromPrimitive (especially useful with literal values), common Float functionality, and more.

If you'd like to use that and/or your own words in a pull request improving the documentation, please feel free.