paupino/rust-decimal

Make rust_decimal_macros exportable from a rust_decimal feature

Closed this issue · 2 comments

In theory this should be possible. The macro only relies on the decimal library to perform string parsing in order to break it down into raw parts to invoke the const initialization function.

It's possible that this logic could instead be imported (e.g. via include!) or some other method as opposed to requiring the full library. This would then open up the possibility of including the macros via a feature flag.

https://github.com/serde-rs/serde/blob/master/serde/src/lib.rs#L329

https://github.com/diesel-rs/diesel/blob/master/diesel/src/lib.rs#L317

The common way to do this is just have a pub use with a feature to enable the macro. I can raise a quick MR for it, if you're still interested in this.

Thanks for taking a look at this! This actually got included a few weeks ago and is lined up for the next release - I forgot to link the issue 😬 #628