-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hey @dlon, @faern and @pinkisemils (and CC @pronebird).
I maintain a crate called objc2-system-configuration which is similar to system-configuration-sys. I was wondering if you'd be interested in using this crate in system-configuration instead?
objc2-system-configuration is part of the objc2 project along with a bunch of other wrappers for Apple frameworks. It is auto-generated using a custom binding generator and a small configuration file, similar to what you do with bindgen and generate_bindings.sh.
I believe objc2-system-configuration provides a number of advantages though, primarily:
- It is complete.
system-configuration-sysis still lacking some APIs.
- It has automatic memory management.
- All
CFRetain/CFReleasecalls are handled by the binding generator (it knows about the get/create rule). - This means that there's no longer a need for getting it right which
T::wrap_under_get_rule/T::wrap_under_create_ruleto call. - Specifically, something like
SCPreferencesGetSignaturewould automatically callCFRetainand return the smart pointerCFRetained.
- All
- It has nullability information.
- E.g.
SCDynamicStoreCopyKeyListknows to return anOption<CFRetained<CFArray>>, so error-prone checks for.is_nullare now unnecessary. - Would have caught Added
nullchecks to dynamic store APIs #59.
- E.g.
I've put up #70 so you can see how it'd look, let me know what you think?
Relatedly, core-foundation is soft-deprecated in favour of objc2-core-foundation, see servo/core-foundation-rs#729 (this issue also contains more details and background on how the objc2-* crates work). So at some point it'd in the very least make sense to move to objc2-core-foundation.