pub unsafe trait MessageReceiver: Sealed + Sized {
    unsafe fn send_message<A, R>(self, sel: Sel, args: A) -> R
    where
        A: MessageArguments,
        R: EncodeConvert
, { ... } unsafe fn send_super_message<A, R>(
        self,
        superclass: &Class,
        sel: Sel,
        args: A
    ) -> R
    where
        A: MessageArguments,
        R: EncodeConvert
, { ... } }
Expand description

Types that can directly be used as the receiver of Objective-C messages.

Examples include objects, classes, and blocks.

This is a sealed trait (for now) that is automatically implemented for pointers to types implementing Message, so that code can be generic over the message receiver.

This is mostly an implementation detail; you’ll want to implement Message for your type instead.

Safety

This is a sealed trait, and should not need to be implemented. Open an issue if you know a use-case where this restrition should be lifted!

Provided Methods

Sends a message to self with the given selector and arguments.

The correct version of objc_msgSend will be chosen based on the return type. For more information, see the section on “Sending Messages” in Apple’s documentation.

If the selector is known at compile-time, it is recommended to use the msg_send! macro rather than this method.

Safety

This shares the same safety requirements as msg_send!.

The added invariant is that the selector must take the same number of arguments as is given.

Sends a message to a specific superclass with the given selector and arguments.

The correct version of objc_msgSend_super will be chosen based on the return type. For more information, see the section on “Sending Messages” in Apple’s documentation.

If the selector is known at compile-time, it is recommended to use the msg_send!(super(...), ...) macro rather than this method.

Safety

This shares the same safety requirements as msg_send!(super(...), ...).

The added invariant is that the selector must take the same number of arguments as is given.

Implementations on Foreign Types

Implementors