TL;DR: make it easier to write shared code interfacing shadow's output.
Currently, shadow only generates pub const VAR: &str variables - it's great as is, but is also quite a bit unwieldy, leading to a lot of boilerplate in multi-binary projects.
There are two main benefits to this approach:
easier manipulation and code decoupling - if I want to write display methods, I could have functions accepting a reference to that struct
API documentation is easier - just look up said structure
TL;DR: make it easier to write shared code interfacing
shadow
's output.Currently,
shadow
only generatespub const VAR: &str
variables - it's great as is, but is also quite a bit unwieldy, leading to a lot of boilerplate in multi-binary projects.There are two main benefits to this approach:
This also ties into what @epage wrote in https://github.com/baoyachi/shadow-rs/issues/75#issuecomment-1048035937 - such a struct would work as an accessor. Or rather, structs, as it would be then split per-source (git, rust, etc).
In my project I have a struct (not using all variables), which could easily be made as a part of code generation, like this:
which is then initialized with: