Skip to content

Use objc2-system-configuration instead of system-configuration-sys? #69

@madsmtm

Description

@madsmtm

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-sys is still lacking some APIs.
  • It has automatic memory management.
    • All CFRetain/CFRelease calls 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_rule to call.
    • Specifically, something like SCPreferencesGetSignature would automatically call CFRetain and return the smart pointer CFRetained.
  • It has nullability information.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions