I have a project that I want, when a certain feature is enabled, to compile additional binaries in addition to the main one.
I couldn't find any proper documentation on the subject. The only thing I could find is that I should use a [[bin]] section but I couldn't find how to use it.
This is puzzling to me since I can't see how this is actually useful. If I try and add there any "mod _;" to code outside the bin directory, it wont recognize it (obviously, since it is in the folder above). So I know I can allow it to use it with #[path], but it is starting to feel more and more hacky and not so ergonomic. This feels like it's only useful for toy, simple, side binaries and not something that needs to share actual code with the main binary. I am probably missing something here.
If you want more control over the file structure, an explicit [[bin]] section works like:
name = "some-name"
path = "path/to/main.rs"
Thank you, I was able to get this to work by having multiple [[bin]] elements. Not really knowing TOML too well I didn't realize I could have multiple [[bin]] entries.
Now I just need to understand how I can disable one based on features.
My use case is that I have a hex editor that by default has only a terminal UI, and if the gtk feature is enabled I want to build the gtk UI as well.