madsmtm / objc2

Bindings to Apple's frameworks in Rust
https://docs.rs/objc2/
MIT License
281 stars 35 forks source link

Rework cargo features #581

Closed madsmtm closed 2 months ago

madsmtm commented 3 months ago

Rework icrate Cargo features to be per file instead of per class. This means that all items are now properly feature-gated, which should improve compile time!

~Amazingly, Cargo allows features to depend on each other, which actually works out perfectly for our use-case, and allows us to do things in a way that should be fairly easy to understand; whenever a file A uses some type from file B, the Cargo feature for file A then requires the Cargo feature for file B. This means that everything defined in the file is now guaranteed to be available, and you only have to worry about the feature flags for things that you import.~

EDIT: I've decided to go with another option for now; no features depend on each other. This is a lot more verbose in the user's Cargo.toml, but the compile-time benefits are immense!

Part of https://github.com/madsmtm/objc2/issues/537.