Skip to content

Commit e3be587

Browse files
committed
Move foundation macros
1 parent 1aff0f0 commit e3be587

File tree

8 files changed

+17
-8
lines changed

8 files changed

+17
-8
lines changed

objc2/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212
feature flags to make the `class!` macro zero cost.
1313
* Moved the external crate `objc2_foundation` into `objc2::foundation` under
1414
(default) feature flag `"foundation"`.
15+
* Added `declare_class!`, `extern_class!` and `ns_string!` macros from
16+
`objc2-foundation`.
17+
18+
### Changed
19+
* Change selector syntax in `declare_class!` macro to be more Rust-like.
1520

1621

1722
## 0.3.0-beta.1 - 2022-07-19

objc2/CHANGELOG_FOUNDATION.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1616
* Add extra `Extend<&u8>` impl for `NSMutableData`.
1717

1818
### Changed
19-
* Change selector syntax in `declare_class!` macro to be more Rust-like.
2019
* **BREAKING**: Moved from external crate `objc2_foundation` into
2120
`objc2::foundation`.
2221

@@ -36,7 +35,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
3635
safe to call on the main thread.
3736
* Added `NSException` object.
3837
* Added `extern_class!` macro to help with defining interfaces to classes.
38+
Further changelog for this can be found in `CHANGELOG.md`.
3939
* Added `declare_class!` macro to help with declaring custom classes.
40+
Further changelog for this can be found in `CHANGELOG.md`.
4041
* Expose the `objc2` version that this uses in the crate root.
4142
* Added `NSZone`.
4243

objc2/src/foundation/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,15 @@ extern "C" {}
6565
#[link(name = "gnustep-base", kind = "dylib")]
6666
extern "C" {}
6767

68-
#[doc(hidden)]
69-
pub mod __string_macro;
7068
mod array;
7169
mod attributed_string;
7270
mod comparison_result;
7371
mod copying;
7472
mod data;
75-
mod declare_macro;
7673
mod dictionary;
7774
mod enumerator;
7875
mod exception;
7976
mod geometry;
80-
mod macros;
8177
mod mutable_array;
8278
mod mutable_attributed_string;
8379
mod mutable_data;

objc2/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ pub extern crate self as objc2;
228228
#[doc(hidden)]
229229
pub extern crate std as __std;
230230
#[doc(hidden)]
231-
pub use self::foundation::__string_macro;
231+
#[cfg(feature = "foundation")]
232+
pub use self::macros::ns_string as __string_macro;
232233

233234
// Hack to make doctests work
234235
#[cfg(all(feature = "apple", feature = "unstable-static-class"))]

objc2/src/macros.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
mod declare_class;
2+
mod extern_class;
3+
#[doc(hidden)]
4+
#[cfg(feature = "foundation")]
5+
pub mod ns_string;
6+
17
/// Gets a reference to a [`Class`] from the given name.
28
///
39
/// [`Class`]: crate::runtime::Class
File renamed without changes.

objc2/src/foundation/__string_macro.rs renamed to objc2/src/macros/ns_string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::sync::atomic::{AtomicPtr, Ordering};
1717
use objc2::rc::Id;
1818
use objc2::runtime::Class;
1919

20-
use super::NSString;
20+
use crate::foundation::NSString;
2121

2222
// This is defined in CoreFoundation, but we don't emit a link attribute
2323
// here because it is already linked via Foundation.
@@ -508,7 +508,7 @@ mod tests {
508508
"\0",
509509
"\0\x01\x02\x03\x04\x05\x06\x07\x08\x09",
510510
// "\u{feff}", // TODO
511-
include_str!("__string_macro.rs"),
511+
include_str!("ns_string.rs"),
512512
}
513513
}
514514

0 commit comments

Comments
 (0)