num-rational icon indicating copy to clipboard operation
num-rational copied to clipboard

Document features

Open maxbla opened this issue 5 years ago • 3 comments

This crate makes use of features so that "you don't pay for what you don't use" and to support no_std while allowing for extensions that require the standard library. This is good, but it can be beginner unfriendly. The readme should include a brief overview of the features this crate provides with a beginner friendly presentation.

maxbla avatar Mar 13 '20 15:03 maxbla

Sure, would you like to write that up? The current features are:

  • std enables the full standard library (on by default)
  • bigint-std enables BigRational using std (on by default)
  • bigint enables BigRational using just core and alloc (requires Rust 1.36+)
  • serde implements Deserialize and Serialize for Ratio<T>

Technically, cargo will accept num-bigint as a feature here too for the optional dependency, but it doesn't actually enable anything in num-rational. I'm now thinking we should simplify that one -- package renaming can let us have just bigint and our added bigint-std, or we can go the other way to full num-bigint and add explicit num-bigint-std instead. Thoughts?

cuviper avatar Mar 13 '20 23:03 cuviper

I ran into this myself. I started writing a custom serializer for a Rational type and then realized that it already existed. But I could find no mention of the serde feature anywhere (except by reading the code). Do you want me to submit a PR for a change to the docs?

ghost avatar Aug 06 '21 15:08 ghost

Sure, a PR to improve docs would be welcome!

cuviper avatar Aug 28 '21 01:08 cuviper