pub unsafe trait MessageReceiver: Sealed + Sized {
    // Provided methods
    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§

source

unsafe fn send_message<A, R>(self, sel: Sel, args: A) -> Rwhere A: MessageArguments, R: EncodeConvert,

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.

source

unsafe fn send_super_message<A, R>( self, superclass: &Class, sel: Sel, args: A ) -> Rwhere A: MessageArguments, R: EncodeConvert,

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§

source§

impl<'a, T: Message + ?Sized> MessageReceiver for &'a T

source§

impl<T: Message + ?Sized> MessageReceiver for *const T

source§

impl<T: Message + ?Sized> MessageReceiver for *mut T

source§

impl<T: Message + ?Sized, O: Ownership> MessageReceiver for ManuallyDrop<Id<T, O>>

source§

impl<T: Message + ?Sized> MessageReceiver for NonNull<T>

source§

impl<'a, T: Message + ?Sized> MessageReceiver for &'a mut T

source§

impl MessageReceiver for *const Class

Implementors§

source§

impl<'a> MessageReceiver for &'a Class

source§

impl<'a, T: Message + ?Sized> MessageReceiver for &'a mut Id<T, Owned>

source§

impl<'a, T: Message + ?Sized, O: Ownership> MessageReceiver for &'a Id<T, O>