Objective-C Runtime bindings and wrapper for Rust.
Objective-C objects can be messaged using the
let cls = class!(NSObject); let obj: *mut Object = msg_send![cls, new]; let hash: usize = msg_send![obj, hash]; let is_kind: BOOL = msg_send![obj, isKindOfClass:cls]; // Even void methods must have their return type annotated let _: () = msg_send![obj, release];
Utilities for reference counting Objective-C objects are provided in the
Objective-C classes can even be declared from Rust using the functionality of
By default, if the
msg_send! macro causes an exception to be thrown, this
will unwind into Rust resulting in unsafe, undefined behavior.
However, this crate has an
"exception" feature which, when enabled, wraps
msg_send! in a
@catch and panics if an exception is caught,
preventing Objective-C from unwinding into Rust.
The Objective-C runtime includes encodings for each method that describe the argument and return types. This crate can take advantage of these encodings to verify that the types used in Rust match the types encoded for the method.
To use this functionality, enable the
With this feature enabled, type checking is performed for every message send,
which also requires that all arguments and return values for all messages
If this requirement is burdensome or you'd rather
just verify specific messages, you can call the
for specific selectors.
The bindings can be used on Linux or *BSD utilizing the GNUstep Objective-C runtime.
Functionality for declaring Objective-C classes.
Utilities for reference counting Objective-C objects.
A Rust interface for the functionality of the Objective-C runtime.
Gets a reference to a
Sends a message to an object.
Registers a selector, returning a
An Objective-C type encoding.
An error encountered while attempting to send a message.
Types that have an Objective-C type encoding.
Types that represent a group of arguments, where each has an Objective-C type encoding.
Types that may be sent Objective-C messages. For example: objects, classes, and blocks.
Types that may be used as the arguments of an Objective-C message.