Skip to content

Commit

Permalink
Add available! macro
Browse files Browse the repository at this point in the history
This includes internal methods for looking up the OS version at runtime,
and for looking up the deployment target at compile time.
  • Loading branch information
madsmtm committed Oct 4, 2024
1 parent 67a4acd commit 6e50923
Show file tree
Hide file tree
Showing 25 changed files with 1,786 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/objc2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Allow using `Into` to convert to retained objects.
* Make `Retained::into_super` an inherent method instead of an associated
method. This means that you can now use it as `.into_super()`.
* Added the `available!()` macro for determining whether code is running on
a given operating system.

### Changed
* **BREAKING**: Changed how you specify a class to only be available on the
Expand Down
3 changes: 3 additions & 0 deletions crates/objc2/src/__macro_helpers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub use core::borrow::Borrow;
pub use core::cell::UnsafeCell;
pub use core::convert::AsRef;
pub use core::default::Default;
pub use core::marker::{PhantomData, Sized};
pub use core::mem::{size_of, ManuallyDrop, MaybeUninit};
pub use core::ops::Deref;
Expand All @@ -21,6 +22,7 @@ mod method_family;
mod module_info;
mod msg_send;
mod msg_send_retained;
mod os_version;
mod writeback;

pub use self::cache::{CachedClass, CachedSel};
Expand All @@ -38,6 +40,7 @@ pub use self::method_family::{
pub use self::module_info::ModuleInfo;
pub use self::msg_send::MsgSend;
pub use self::msg_send_retained::{MaybeUnwrap, MsgSendId, MsgSendSuperId};
pub use self::os_version::{is_available, AvailableVersion, OSVersion};

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

0 comments on commit 6e50923

Please sign in to comment.