servo / core-foundation-rs

Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS
Other
1.01k stars 222 forks source link

Fix TCFType macros for generic types #652

Closed tmandry closed 2 months ago

tmandry commented 10 months ago

impl_TCFType! accepts generic types but some of its impls are missing the generics. They work on types with defaulted generics, but only in the default case. This PR fixes that.

It also updates declare_TCFType! to accept generics as a convenience. We use one PhantomData per parameter, as is already done in impl_TCFType!.

In addition, some warnings are silenced, and the macros no longer depend on any traits being in scope in the caller.

tmandry commented 9 months ago

This is needed to create a type-safe generic abstraction over AXValue; see value.rs in https://github.com/eiz/accessibility/pull/5.

tmandry commented 9 months ago

Friendly ping @jdm, would you or another maintainer be willing to take a look at this?

waywardmonkeys commented 2 months ago

@tmandry I'd like to get this unblocked for you. Could you rebase to current main?

tmandry commented 2 months ago

Thanks for taking a look @waywardmonkeys. Should be ready now.