Cargo Features

[dependencies]
objc2 = { version = "0.5.1", default-features = false, features = ["std", "alloc", "exception", "catch-all", "relax-void-encoding", "unstable-msg-send-always-comma", "malloc", "verify", "unstable-static-sel", "unstable-static-sel-inlined", "unstable-static-class", "unstable-static-class-inlined", "unstable-autoreleasesafe", "unstable-c-unwind", "unstable-docsrs", "unstable-apple-new", "apple", "gnustep-1-7", "gnustep-1-8", "gnustep-1-9", "gnustep-2-0", "gnustep-2-1", "unstable-compiler-rt"] }

NOTE: 'unstable' features are _not_ considered part of the SemVer contract,
and may be removed in a minor release.

default = apple, std

These default features are set whenever objc2 is added without default-features = false somewhere in the dependency tree.

std default = alloc

Currently not possible to turn off, put here for forwards compatibility.

Enables std of objc-sys and objc2-encode

alloc std

Enables alloc of objc-sys and objc2-encode

objc2-encode:

Currently not possible to turn off, put here for forwards compatibility

exception catch-all?

Enables objc2::exception::throw and objc2::exception::catch

Enables unstable-exception of objc-sys

catch-all = exception

Wrap every objc2::msg_send call in a @try/@catch block

relax-void-encoding

Allow *const c_void and *mut c_void to be used as arguments and return types where other pointers were expected.

This may be useful for CoreFoundation types, or for migrating code from objc to objc2.

unstable-msg-send-always-comma

Enable deprecation of using msg_send! without a comma between arguments.

malloc = malloc_buf

This was necessary to access certain functionality in the past, but it is no longer required.

verify

This was necessary to enable certain debug assertions in the past, but it is no longer required.

unstable-static-sel unstable-static-sel-inlined? = objc2-proc-macros

Make the sel! macro look up the selector statically.

The plan is to enable this by default, but right now we are uncertain of its stability, and it might need significant changes before being fully ready!

Please test it, and report any issues you may find: https://github.com/madsmtm/objc2/issues/new

unstable-static-sel-inlined = unstable-static-sel
unstable-static-class unstable-static-class-inlined? = objc2-proc-macros
unstable-static-class-inlined = unstable-static-class
unstable-autoreleasesafe

Uses nightly features to make autorelease pools fully sound

unstable-c-unwind

Uses the nightly c_unwind feature to make throwing safe

You must manually enable objc-sys/unstable-c-unwind to use this.

unstable-docsrs

For better documentation on docs.rs

unstable-apple-new = apple

Enable some new features available on ARM64 on:

  • macOS 13.0
  • iOS 16.0
  • tvOS 16.0
  • watchOS 9.0

See https://developer.apple.com/videos/play/wwdc2022/110363/ for an overview of the features.

Currently untested, might be unsound or lead to confusing compiler errors.

Additionally, the message sending improvements is not yet implemented.

apple default unstable-apple-new? unstable-compiler-rt?

Runtime selection. See objc-sys for details.

Enables apple of objc-sys

Affects __nsstring::UTF8_ENCODING

gnustep-1-7 gnustep-1-8?

Enables gnustep-1-7 of objc-sys

objc-sys:

Link to GNUStep's libobjc2

Affects __nsstring::UTF8_ENCODING

gnustep-1-8 gnustep-1-9? = gnustep-1-7

Enables gnustep-1-8 of objc-sys

gnustep-1-9 gnustep-2-0? = gnustep-1-8

Enables gnustep-1-9 of objc-sys

gnustep-2-0 gnustep-2-1? = gnustep-1-9

Enables gnustep-2-0 of objc-sys

gnustep-2-1 = gnustep-2-0

Enables gnustep-2-1 of objc-sys

unstable-compiler-rt = apple

Used by block2

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

malloc_buf malloc?
objc2-proc-macros unstable-static-class? unstable-static-sel?