Closed ghost closed 6 years ago
This seems to be the same as #38. Is there any way in which we could make this clearer in the documentation?
Sorry for the duplicate issue. Is there no way to make features depend on each other automagically?
Failing that, perhaps the example should include (at least a fragment of) a Cargo.toml file - perhaps in a comment at the top of the file?
Edit: I thought I was enabling the features in my Cargo.toml, but I was not. I think a more full-featured example would help the newbies, such as myself.
@voltagex I tried to improve the wording of the README
in this PR branch: https://github.com/Boddlnagg/winrt-rust/tree/multifile-gen. It now includes a fragment of Cargo.toml
. What do you think, is this better?
Surely there is lots of room for improvement still ...
Is there no way to make features depend on each other automagically?
winapi-rs
uses a custom build.rs
file that turns on features based on the dependency graph. Perhaps a similar file could be used in this case too.
However, their build.rs
file is manually written. I don't know if the Windows Metadata files also contain dependency information, and manually writting all the dependencies might take quite a while.
@GuildMasterInfinite Interesting! However, in WinRT, the number of features is rather small (17), and problems with interdependencies are already worked around by cfg'ing out parts of the API (e.g., if a function in Windows.System
refers to a data structure defined in Windows.Storage
, that function will not be available unless Windows.Storage
is also enabled via the windows-storage
feature).
I don't see any way to make the handling of features any easier, except maybe:
By the way, when you're writing a C# application for WinRT, you also have to manually reference all the WinMD files that are directly needed. Since WinMD files map 1:1 to our Cargo features, you have to essentially do the same thing when using this crate.
I consider this issue to be solved.
My Cargo.toml:
main.rs:
(to be replaced with a toast notification as soon as I can make it work)