Conversation
| /// Bool mapping types differ between ARM and x64. There's a number of places that we need to check | ||
| /// against BOOL results throughout the framework, and this just simplifies some mismatches. | ||
| #[inline(always)] | ||
| pub fn to_bool(result: BOOL) -> bool { |
There was a problem hiding this comment.
This makes me stupidly happy to see deleted.
|
This one also looks fine to me, albeit needs a touch of rebase it seems. |
0942f27 to
d281529
Compare
|
I've incorporated a few fixes from a newer version of |
d281529 to
16d62e9
Compare
| pub(crate) fn register_window_controller_class<T: WindowDelegate>() -> *const Class { | ||
| static mut DELEGATE_CLASS: *const Class = 0 as *const Class; | ||
| pub(crate) fn register_window_controller_class<T: WindowDelegate>() -> &'static Class { | ||
| static mut DELEGATE_CLASS: Option<&'static Class> = None; |
There was a problem hiding this comment.
Does this need to be an Option<&'static Class> because it was initialized as 0 as *const Class before? I think the only part that feels odd to me is the unsafe { DELEGATE_CLASS.unwrap() }.
There was a problem hiding this comment.
The static is created before the program begins, so it has to be initialized to some value, in this case None. When the function is called the first time, the class is created and the static is set to the new value.
The unsafety in unsafe { DELEGATE_CLASS.unwrap() } comes from the fact that DELEGATE_CLASS is a mutable static, and hence can only be accessed behind unsafe. Data races are prevented by Once.
In essence, what we do here with DELEGATE_CLASS and Once is similar to once_cell::sync::Lazy and the nightly std::cell::LazyCell.
|
Where's this one sit with regards to #30? Should I just ignore it at this point? |
|
No, I'll pick it up again after #30 |
|
Kk sounds good! |
16d62e9 to
85649e5
Compare
|
Is this still being worked on? It seems like the usage of beta |
|
No, I haven't worked on this crate in a long while, unfortunately. I still think there is value in what it is providing (a more rustic interface to Apple APIs), but my own focus has been on improving |
Builds upon #30.
Fix warnings introduced by
objc2deprecating certain functionality.