madsmtm / objc2

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

Use `impl` instead of ProtocolObject where possible #517

Open madsmtm opened 8 months ago

madsmtm commented 8 months ago

Builds upon https://github.com/madsmtm/objc2/pull/516.

We now use &(impl MyProtocol + Message) instead of &ProtocolObject<dyn MyProtocol> as parameters to functions, this allows users to pass in their objects to these functions much more easily.

I'm not sure it's worth the tradeoff in code size though (since now a lot of methods are generic where they don't really have to be), will have to think about.

Alternative to https://github.com/madsmtm/objc2/pull/460 (that one is still strictly cleaner, but probably also not really possible in current Rust (?)).