Skip to content

Commit c3857d5

Browse files
committed
Add available! macro
This includes internal methods for looking up the OS version at runtime, and for looking up the deployment target at compile time.
1 parent 8852b5d commit c3857d5

25 files changed

+2233
-43
lines changed

Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/objc2/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2424
* Allow using `Into` to convert to retained objects.
2525
* Make `Retained::into_super` an inherent method instead of an associated
2626
method. This means that you can now use it as `.into_super()`.
27+
* Added the `available!()` macro for determining whether code is running on
28+
a given operating system.
2729

2830
### Changed
2931
* **BREAKING**: Changed how you specify a class to only be available on the

crates/objc2/src/__macro_helpers/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub use core::borrow::Borrow;
22
pub use core::cell::UnsafeCell;
33
pub use core::convert::AsRef;
4+
pub use core::default::Default;
45
pub use core::marker::{PhantomData, Sized};
56
pub use core::mem::{size_of, ManuallyDrop, MaybeUninit};
67
pub use core::ops::Deref;
@@ -21,6 +22,7 @@ mod method_family;
2122
mod module_info;
2223
mod msg_send;
2324
mod msg_send_retained;
25+
mod os_version;
2426
mod writeback;
2527

2628
pub use self::cache::{CachedClass, CachedSel};
@@ -38,6 +40,7 @@ pub use self::method_family::{
3840
pub use self::module_info::ModuleInfo;
3941
pub use self::msg_send::MsgSend;
4042
pub use self::msg_send_retained::{MaybeUnwrap, MsgSendId, MsgSendSuperId};
43+
pub use self::os_version::{is_available, AvailableVersion, OSVersion};
4144

4245
/// Disallow using this passed in value in const and statics for forwards
4346
/// compatibility (this function is not a `const` function).

0 commit comments

Comments
 (0)