@@ -71,10 +71,10 @@ macro_rules! sel {
71
71
/// ```
72
72
///
73
73
/// This way we are clearly communicating to Rust that: The method
74
- /// `doSomething:` works on shared references to an object. It takes a C-style
75
- /// signed integer, and returns a pointer to what is probably a C-compatible
76
- /// string. Now it's much, _much_ easier to make a safe abstraction around
77
- /// this!
74
+ /// `doSomething:` works with a shared reference to the object. It takes a
75
+ /// C-style signed integer, and returns a pointer to what is probably a
76
+ /// C-compatible string. Now it's much, _much_ easier to make a safe
77
+ /// abstraction around this!
78
78
///
79
79
/// There exists two variants of this macro, [`msg_send_bool!`] and
80
80
/// [`msg_send_id!`], which can help with upholding certain requirements of
@@ -94,9 +94,12 @@ macro_rules! sel {
94
94
///
95
95
/// All arguments, and the return type, must implement [`Encode`].
96
96
///
97
- /// This translates into a call to [`sel!`], and afterwards a fully qualified
98
- /// call to [`MessageReceiver::send_message`]. Note that this means that
99
- /// auto-dereferencing of the receiver is not supported.
97
+ /// This macro translates into a call to [`sel!`], and afterwards a fully
98
+ /// qualified call to [`MessageReceiver::send_message`]. Note that this means
99
+ /// that auto-dereferencing of the receiver is not supported, and that the
100
+ /// receiver is consumed. You may encounter a little trouble with `&mut`
101
+ /// references, try refactoring into a separate method or reborrowing the
102
+ /// reference.
100
103
///
101
104
/// Variadic arguments are currently not supported.
102
105
///
@@ -127,10 +130,9 @@ macro_rules! sel {
127
130
/// 1. The selector corresponds to a valid method that is available on the
128
131
/// receiver.
129
132
///
130
- /// 2. The argument types must match what the receiver excepts for this
131
- /// selector.
133
+ /// 2. The argument types match what the receiver excepts for this selector.
132
134
///
133
- /// 3. The return type must match what the receiver returns for this selector.
135
+ /// 3. The return type match what the receiver returns for this selector.
134
136
///
135
137
/// 4. The call must not violate Rust's mutability rules, for example if
136
138
/// passing an `&T`, the Objective-C method must not mutate the variable
@@ -166,9 +168,9 @@ macro_rules! sel {
166
168
/// # let obj: *mut Object = 0 as *mut Object;
167
169
/// let description: *const Object = unsafe { msg_send![obj, description] };
168
170
/// // Usually you'd use msg_send_id here ^
169
- /// let _: () = unsafe { msg_send![obj, setArg1: 1 arg2: 2 ] };
170
- /// // Or with an optional comma between arguments:
171
- /// let _: () = unsafe { msg_send![obj, setArg1: 1, arg2: 2 ] };
171
+ /// let _: () = unsafe { msg_send![obj, setArg1: 1u32, arg2: 2i32 ] };
172
+ /// let arg1: i32 = unsafe { msg_send![obj, getArg1] };
173
+ /// let arg2: i32 = unsafe { msg_send![obj, getArg2 ] };
172
174
/// ```
173
175
#[ macro_export]
174
176
macro_rules! msg_send {
@@ -263,7 +265,7 @@ macro_rules! msg_send_bool {
263
265
/// [`msg_send!`] for methods returning `id`, `NSObject*`, or similar object
264
266
/// pointers.
265
267
///
266
- /// Objective-C's object pointers have certain rules for when they should be
268
+ /// Object pointers in Objective-C have certain rules for when they should be
267
269
/// retained and released across function calls. This macro helps doing that,
268
270
/// and returns an [`Option`] (letting you handle failures) containing an
269
271
/// [`rc::Id`] with the object.
@@ -333,10 +335,9 @@ macro_rules! msg_send_bool {
333
335
/// pools!
334
336
///
335
337
/// See [the clang documentation][arc-retainable] for the precise
336
- /// specification.
338
+ /// specification of Objective-C's ownership rules .
337
339
///
338
340
/// This macro doesn't support super methods yet, see [#173].
339
- ///
340
341
/// The `retain`, `release` and `autorelease` selectors are not supported, use
341
342
/// [`Id::retain`], [`Id::drop`] and [`Id::autorelease`] for that.
342
343
///
@@ -402,7 +403,7 @@ macro_rules! msg_send_id {
402
403
} ) ;
403
404
}
404
405
405
- /// Helper macro: To avoid exposing these in the docs for [`msg_send_id!`].
406
+ /// Helper macro to avoid exposing these in the docs for [`msg_send_id!`].
406
407
#[ doc( hidden) ]
407
408
#[ macro_export]
408
409
macro_rules! __msg_send_id_helper {
0 commit comments