Num crate: generic bounds on Rust types, Money/Currency support?

Hello everyone

I am aware of the num crate which has extremely useful Traits like Integer, Signed, Unsigned and Float, etc which I can use as generic bounds on my own code.

These seem to me to be quite fundamental.

Q1: Is there any plan to add or migrate this functionality into Rust standard library ?

Q2: is there any crate that has a Currency/Money financial data types support that you can recommend as best? I have found one crate called rust_decimal, is this the best one to use? I want to handle money data coming from files like JSON documents, Parquet column store files and flat-text CSV files and also to be stored/retrieved from relational databases like PostgreSQL, SQL-Server, MySQL, etc.

Q3: the num crate seems to use macro to handle basic Rust built-in integer and float data types. Why not have a Rust built-in trait for a Integer, Signed, Unsigned and Float data types so that macros are not even necessary to handle basic Rust built-in primitive numeric data? I see similar macro solutions in other libraries also, where the only difference is to invoke same macro 14 times, to use u8,u16, f32, f64, i8...i128. I am sure I am missing something, so hopefully the replies will educate me.

thank you very much

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.