avhz / RustQuant

Rust library for quantitative finance.
https://avhz.github.io
Apache License 2.0
1.07k stars 124 forks source link

Create macro for generating ISO_4217 standard. #240

Closed MeetThePatel closed 2 months ago

avhz commented 2 months ago

Hi thanks for the PR :)

I would prefer to keep the "numeric" code as a string since the convention is 3 digits, padded with leading zeroes (and padding int literals with zeros is superfluous as the clippy lints point out), and we can relatively easily convert to an int with .parse::<u16>() if we need to. In saying that, for the integer case, we can use format!("{:0>3}", 12.to_string()), for example.

Let me know your thoughts. Cheers!

Edit: I would suggest touching base in an issue or Discord prior to making a (large) PR, just so it can be discussed first.

MeetThePatel commented 2 months ago

I updated the macro to use &'static str as per your suggestion. It makes sense, much easier to go from string -> int than the reverse.

avhz commented 2 months ago

Thanks for the PR :)