-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement runtime availability checking #661
base: master
Are you sure you want to change the base?
Conversation
21bbd88
to
6e50923
Compare
Noting my reasoning behind the name/syntax:
|
So, I tested using the So instead, |
765f6a4
to
6bfa34c
Compare
This includes internal methods for looking up the OS version at runtime, and for looking up the deployment target at compile time.
Use atomics directly instead of the heavy `OnceLock`.
6bfa34c
to
e8eab1e
Compare
Thanks for the review before @BlackHoleFox, really useful to get some feedback - if you feel like giving it another review, then feel free to do so now, I think I'm done with everything now. I will try to upstream this implementation to the standard library later (perhaps under |
Add macro for runtime availability checking, with static assertions against the deployment target that allows eliding the runtime checks when unnecessary.
Part of #266.
Usage:
Runtime lookup implementation tested on:
aarch64-apple-darwin
aarch64-apple-ios-macabi
x86_64-apple-ios-macabi
aarch64-apple-ios-sim
x86_64-apple-darwin
i686-apple-darwin
x86_64-apple-ios
armv7-apple-ios
TODO:
sysctl
.os_version!(macos = 15.0, ..)
version!(macos = 15.0, ..)
os_available!(macos = 15.0, ..)
available!(macos(15.0), ..)
available!(macos 15.0, ..)
available!(macOS = 15.0, ..)
available!(macos = 15.0, *)
available!(macos = 15.0, _)
Use macro in examples.No current examples where it makes sense.available!(macos = 15.0)
on e.g. iOS is desirable, or if we just want to returnfalse
here?