063ba16acec969bf4d3533db7875d5180d2169d2
Add CFPropertyList and methods for casting to subclasses https://developer.apple.com/documentation/corefoundation/cfpropertylist-rif specifies the following types as valid subclasess of a property list: CFData, CFString, CFArray, CFDictionary, CFDate, CFBoolean, and CFNumber. So I add a trait, `CFPropertyListSubClass`, and implement it for the valid types. Then add the `CFPropertyList` type and make it work as much as possible as the other `TCFType`s. However, it can't implement that trait, since it can't implement the static method `type_id`. The main point of adding this was to then get to the convenience methods `to_CFPropertyList` and `downcast` that allows safe casting between the subclasses and the superclass. This is handy in calls such as `SCDynamicStoreSetValue` and `SCDynamicStoreCopyValue` where the methods either accept or return a `CFPropertyListRef`. With this addition it becomes easy to write safe wrappers around those functions and make them accept proper, constrained types. Disclaimer: I'm not yet super familiar with CF. So I can only hope this is safe and sound, but I think it is. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/131) <!-- Reviewable:end -->
core-foundation-rs
Compatibility
By default it targets macOS 10.7.
To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To have both 10.8 features and 10.7 compatibility, also set mac_os_10_7_support. Setting both requires weak linkage, which is is a nighty-only feature as of Rust 1.19.
Description
Languages
Rust
100%