Skip to content

Commit 18bae76

Browse files
committed
Renamed object! macro to extern_class!
1 parent 05708e7 commit 18bae76

15 files changed

+25
-25
lines changed

objc2-foundation/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010
* Added `MainThreadMarker` to help with designing APIs where a method is only
1111
safe to call on the main thread.
1212
* Added `NSException` object.
13-
* Added `object!` macro to help with defining other classes.
13+
* Added `extern_class!` macro to help with defining other classes.
1414
* Expose the `objc2` version that this uses in the crate root.
1515

1616
### Changed

objc2-foundation/src/array.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use super::{
1414
NSRange,
1515
};
1616

17-
__inner_object! {
17+
__inner_extern_class! {
1818
/// TODO
1919
///
2020
/// You can have a `Id<NSArray<T, Owned>, Owned>`, which allows mutable access
@@ -43,7 +43,7 @@ unsafe impl<T: Sync + Send> Send for NSArray<T, Shared> {}
4343
unsafe impl<T: Sync> Sync for NSArray<T, Owned> {}
4444
unsafe impl<T: Send> Send for NSArray<T, Owned> {}
4545

46-
__inner_object! {
46+
__inner_extern_class! {
4747
// TODO: Ensure that this deref to NSArray is safe!
4848
// This "inherits" NSArray, and has the same `Send`/`Sync` impls as that.
4949
#[derive(Debug, PartialEq, Eq, Hash)]

objc2-foundation/src/attributed_string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
NSCopying, NSDictionary, NSMutableAttributedString, NSMutableCopying, NSObject, NSString,
77
};
88

9-
object! {
9+
extern_class! {
1010
/// A string that has associated attributes for portions of its text.
1111
///
1212
/// Examples of attributes could be: Visual style, hyperlinks, or

objc2-foundation/src/data.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use objc2::{msg_send, msg_send_id};
1111

1212
use super::{NSCopying, NSMutableCopying, NSObject, NSRange};
1313

14-
object! {
14+
extern_class! {
1515
/// A static byte buffer in memory.
1616
///
1717
/// This is similar to a [`slice`][`prim@slice`] of [`u8`].
@@ -25,7 +25,7 @@ object! {
2525
unsafe impl Sync for NSData {}
2626
unsafe impl Send for NSData {}
2727

28-
object! {
28+
extern_class! {
2929
/// A dynamic byte buffer in memory.
3030
///
3131
/// This is the Objective-C equivalent of a [`Vec`] containing [`u8`].

objc2-foundation/src/dictionary.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use objc2::{msg_send, msg_send_id, Message};
99

1010
use super::{NSArray, NSCopying, NSEnumerator, NSFastEnumeration, NSObject};
1111

12-
__inner_object! {
12+
__inner_extern_class! {
1313
#[derive(Debug, PartialEq, Eq, Hash)]
1414
unsafe pub struct NSDictionary<K, V>: NSObject {
1515
key: PhantomData<Id<K, Shared>>,

objc2-foundation/src/exception.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use objc2::{msg_send, msg_send_id, sel};
99

1010
use crate::{NSCopying, NSDictionary, NSObject, NSString};
1111

12-
object! {
12+
extern_class! {
1313
/// A special condition that interrupts the normal flow of program
1414
/// execution.
1515
///

objc2-foundation/src/macros.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
/// ```
4444
/// use objc2::msg_send_id;
4545
/// use objc2::rc::{Id, Shared};
46-
/// use objc2_foundation::{object, NSObject};
46+
/// use objc2_foundation::{extern_class, NSObject};
4747
/// #
4848
/// # #[cfg(feature = "gnustep-1-7")]
4949
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
5050
///
51-
/// object! {
51+
/// extern_class! {
5252
/// /// An example description.
5353
/// #[derive(PartialEq, Eq, Hash)] // Uses `NSObject`'s implementation
5454
/// // Specify class and superclass
@@ -67,14 +67,14 @@
6767
/// declared previously to specify as its superclass.
6868
///
6969
/// ```
70-
/// use objc2_foundation::{object, NSObject};
70+
/// use objc2_foundation::{extern_class, NSObject};
7171
/// #
72-
/// # object! {
72+
/// # extern_class! {
7373
/// # #[derive(PartialEq, Eq, Hash)]
7474
/// # unsafe pub struct NSFormatter: NSObject;
7575
/// # }
7676
///
77-
/// object! {
77+
/// extern_class! {
7878
/// #[derive(PartialEq, Eq, Hash)]
7979
/// // Specify the correct inheritance chain
8080
/// // `NSDateFormatter` subclasses `NSFormatter` which subclasses `NSObject`
@@ -84,12 +84,12 @@
8484
///
8585
/// See the source code of `objc2_foundation` in general for more examples.
8686
#[macro_export]
87-
macro_rules! object {
87+
macro_rules! extern_class {
8888
(
8989
$(#[$m:meta])*
9090
unsafe $v:vis struct $name:ident: $($inheritance_chain:ty),+;
9191
) => {
92-
$crate::__inner_object! {
92+
$crate::__inner_extern_class! {
9393
@__inner
9494
$(#[$m])*
9595
unsafe $v struct $name<>: $($inheritance_chain,)+ $crate::objc2::runtime::Object {}
@@ -146,15 +146,15 @@ macro_rules! __impl_as_ref_borrow {
146146

147147
#[doc(hidden)]
148148
#[macro_export]
149-
macro_rules! __inner_object {
149+
macro_rules! __inner_extern_class {
150150
// TODO: Expose this variant in the `object` macro.
151151
(
152152
$(#[$m:meta])*
153153
unsafe $v:vis struct $name:ident<$($t:ident $(: $b:ident)?),*>: $($inheritance_chain:ty),+ {
154154
$($p:ident: $pty:ty,)*
155155
}
156156
) => {
157-
$crate::__inner_object! {
157+
$crate::__inner_extern_class! {
158158
@__inner
159159
$(#[$m])*
160160
unsafe $v struct $name<$($t $(: $b)?),*>: $($inheritance_chain,)+ $crate::objc2::runtime::Object {

objc2-foundation/src/mutable_attributed_string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use objc2::{msg_send, msg_send_id};
33

44
use crate::{NSAttributedString, NSCopying, NSMutableCopying, NSObject, NSString};
55

6-
object! {
6+
extern_class! {
77
/// A mutable string that has associated attributes.
88
///
99
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutableattributedstring?language=objc).

objc2-foundation/src/mutable_string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use objc2::{msg_send, msg_send_id};
88

99
use crate::{NSCopying, NSMutableCopying, NSObject, NSString};
1010

11-
object! {
11+
extern_class! {
1212
/// A dynamic plain-text Unicode string object.
1313
///
1414
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutablestring?language=objc).

objc2-foundation/src/object.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use objc2::{msg_send, msg_send_bool, msg_send_id};
77

88
use super::NSString;
99

10-
__inner_object! {
10+
__inner_extern_class! {
1111
@__inner
1212
unsafe pub struct NSObject<>: Object {}
1313
}

objc2-foundation/src/process_info.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use objc2::rc::{Id, Shared};
33

44
use crate::{NSObject, NSString};
55

6-
object! {
6+
extern_class! {
77
/// A collection of information about the current process.
88
///
99
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprocessinfo?language=objc).

objc2-foundation/src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const UTF8_ENCODING: i32 = 4;
2727
#[allow(non_upper_case_globals)]
2828
const NSNotFound: ffi::NSInteger = ffi::NSIntegerMax;
2929

30-
object! {
30+
extern_class! {
3131
/// A static, plain-text Unicode string object.
3232
///
3333
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsstring?language=objc).

objc2-foundation/src/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use objc2::{msg_send, msg_send_bool, msg_send_id};
55

66
use crate::{NSObject, NSString};
77

8-
object! {
8+
extern_class! {
99
/// A thread of execution.
1010
///
1111
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsthread?language=objc).

objc2-foundation/src/uuid.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use objc2::{msg_send, msg_send_id, Encode, Encoding, RefEncode};
33

44
use super::{NSCopying, NSObject};
55

6-
object! {
6+
extern_class! {
77
/// A universally unique value.
88
///
99
/// Can be used to identify types, interfaces, and other items.

objc2-foundation/src/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use objc2::{msg_send, msg_send_id};
1414

1515
use super::{NSCopying, NSObject};
1616

17-
__inner_object! {
17+
__inner_extern_class! {
1818
// `T: Eq` bound correct to prevent `NSValue<f32>` from being `Eq`
1919
// (even though `[NAN isEqual: NAN]` is true in Objective-C).
2020
#[derive(Debug, PartialEq, Eq, Hash)]

0 commit comments

Comments
 (0)