objc2 0.4.1

Objective-C interface and runtime bindings
Documentation
[package]
name = "objc2"
version = "0.4.1" # Remember to update html_root_url in lib.rs
authors = ["Steven Sheldon", "Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"

description = "Objective-C interface and runtime bindings"
keywords = ["objective-c", "macos", "ios", "objc_msgSend", "objc"]
categories = [
    "api-bindings",
    "development-tools::ffi",
    "os::macos-apis",
]
readme = "README.md"
repository = "https://github.com/madsmtm/objc2"
documentation = "https://docs.rs/objc2/"
license = "MIT"

# NOTE: 'unstable' features are _not_ considered part of the SemVer contract,
# and may be removed in a minor release.
[features]
default = ["std", "apple"]

# Currently not possible to turn off, put here for forwards compatibility.
std = ["alloc", "objc2-encode/std", "objc-sys/std"]
alloc = ["objc2-encode/alloc", "objc-sys/alloc"]

# Enables `objc2::exception::throw` and `objc2::exception::catch`
exception = ["objc-sys/unstable-exception"]

# Wrap every `objc2::msg_send` call in a `@try/@catch` block
catch-all = ["exception"]

# Enable all verification steps when debug assertions are enabled.
verify = ["malloc"]

# 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.
relax-void-encoding = []

# Expose features that require linking to `libc::free`.
#
# This is not enabled by default because most users won't need it, and it
# increases compilation time.
malloc = ["malloc_buf"]

# 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 = ["objc2-proc-macros"]
unstable-static-sel-inlined = ["unstable-static-sel"]
unstable-static-class = ["objc2-proc-macros"]
unstable-static-class-inlined = ["unstable-static-class"]

# Uses nightly features to make autorelease pools fully sound
unstable-autoreleasesafe = []

# Uses the nightly c_unwind feature to make throwing safe
#
# You must manually enable `objc-sys/unstable-c-unwind` to use this.
unstable-c-unwind = []

# For better documentation on docs.rs
unstable-docsrs = []

# 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.
unstable-apple-new = ["apple"]

# Runtime selection. See `objc-sys` for details.
apple = ["objc-sys/apple"]
gnustep-1-7 = ["objc-sys/gnustep-1-7"]
gnustep-1-8 = ["gnustep-1-7", "objc-sys/gnustep-1-8"]
gnustep-1-9 = ["gnustep-1-8", "objc-sys/gnustep-1-9"]
gnustep-2-0 = ["gnustep-1-9", "objc-sys/gnustep-2-0"]
gnustep-2-1 = ["gnustep-2-0", "objc-sys/gnustep-2-1"]
# Used by `block2`
unstable-compiler-rt = ["apple"]

[dependencies]
malloc_buf = { version = "1.0", optional = true }
objc-sys = { path = "../objc-sys", version = "0.3.1", default-features = false }
objc2-encode = { path = "../objc2-encode", version = "3.0.0", default-features = false }
objc2-proc-macros = { path = "../objc2-proc-macros", version = "0.1.1", optional = true }

[dev-dependencies]
iai = { version = "0.1", git = "https://github.com/madsmtm/iai", branch = "callgrind" }
static_assertions = "1.1.0"

[[bench]]
name = "autorelease"
harness = false

[package.metadata.docs.rs]
default-target = "x86_64-apple-darwin"
features = ["exception", "malloc", "unstable-docsrs"]

targets = [
    # MacOS
    "x86_64-apple-darwin",
    "aarch64-apple-darwin",
    # "i686-apple-darwin",
    # iOS
    "aarch64-apple-ios",
    "x86_64-apple-ios",
    # "armv7-apple-ios",
    # "i386-apple-ios",
    # GNUStep
    "x86_64-unknown-linux-gnu",
    "i686-unknown-linux-gnu",
    # Windows
    "x86_64-pc-windows-msvc",
]