I want initialise struct in const context without usage of lazy_static and similar stuff.
Just plain constant.
But current stable rustc can no evaluate code that I need in const context (the main problem are math functions, like sin, sqrt and so on).
So the part of calculation is simple, I use build script and calculate what I need.
But how I save result back to Rust?
Is any serde like crates, where I can do something like this:
I can calculate the resulting value of Foo.
The problem exactly in code generation.
I use Foo in build.rs as type. In other words,
I use module where Foo defined from my build.rs.
Yeah, this is almost what I want. The problem is that default Debug implementation uses unknown precision of float points. But I suppose I can implement my own Debug implementation of Foo, that replace print of all float values with hex float.
I can't find a reference document to cite (best I could quickly find is things like this PR where it was done), but Rust's floating-point printing will not lose precision — it will print enough digits to reproduce the number, unless you ask for a specific number of digits.