metal-rs
metal-rs copied to clipboard
Use `objc2` instead of `objc`
Replace objc
with my fork, objc2
.
This crate contains many improvements, in particular:
- Better tools for protecting against UB (see first commit)
- You no longer have to worry about using
bool
inmsg_send!
. - The
msg_send_id!
macro greatly helps with follow memory management rules (similar to Objective-C ARC), potentially also alleviating a lot of the need for autoreleasepools. - The
extern_protocol!
macro is used in place offoreign_obj_type!
Notable breaking changes:
-
objc2::Message
differs fromobjc::Message
, so message sending is not compatible -
NSUInteger
is nowusize
instead ofu32
/u64
depending on platform (equivalently forNSInteger
) -
There is no longer three types for each class (e.g.
MTLFoo
,Foo
andFooRef
); these have been combined into one:Foo
. Pointers to this can be used across FFI boundaries, andobjc2::rc::Id<Foo, Shared>
can be used as a strong pointer. In table form:Previously Now *mut MTLFoo
*mut Foo
&FooRef
&Foo
Foo
Id<Foo, Shared>
When done, this should resolve the following issues:
- Fixes https://github.com/gfx-rs/metal-rs/issues/5 now
- Later: https://github.com/gfx-rs/metal-rs/issues/222
- Later: https://github.com/gfx-rs/metal-rs/issues/218
- Later: https://github.com/gfx-rs/metal-rs/issues/128
- Later: https://github.com/gfx-rs/metal-rs/issues/86
- Later: https://github.com/gfx-rs/metal-rs/issues/99
- Later: https://github.com/gfx-rs/metal-rs/issues/225
- Later: https://github.com/gfx-rs/metal-rs/issues/58
- Later: https://github.com/gfx-rs/metal-rs/issues/282
- Later: https://github.com/gfx-rs/metal-rs/issues/284